GithubHelp home page GithubHelp logo

Comments (2)

JustGlowing avatar JustGlowing commented on June 21, 2024

hi, thanks for raising this issue. I don't have capacity to maintain this notebook and it will soon be removed. Feel free to submit a PR with the changes if you solve the issues.

from minisom.

tomaszek0 avatar tomaszek0 commented on June 21, 2024

ok, my oversight - I checked again. However, 2 errors still remain:
The property plot : Type error: 'float' object is not iterable
I fixed this error by:

zmin = min(properties.iloc[:,2:].min())
zmax = max(properties.iloc[:,2:].max())

def plotDistributionOfDataInClusters: AttributeError: 'DataFrame' object has no attribute 'append'
I fixed this error by:

def plotDistributionOfDataInClusters(som, data, columns, plottype='barpolar'):
size = som.distance_map().shape[0]
clusters = np.array(np.arange(0, size*size)).reshape(size, size)
distributionMapData = []
labels_map = som.labels_map(data, [label_names[t] for t in target])
win_map = som.win_map(data)

for position in win_map.keys():
    label_fracs = [labels_map[position][l] for l in label_names.values()]
    bgcolor = label_fracs.index(np.max(label_fracs))*255//len(label_fracs)
    winner = win_map[position]
    minima = np.min(winner, axis=0)
    means = np.mean(winner, axis=0)
    maxima = np.max(winner, axis=0)
    row = int(position[1]+1)
    col = int(position[0]+1)
    distributionMapData.append({'col': col, 'row': size-row+1, 'min': minima, 'mean': means, 'max': maxima, 'bgcolor' : bgcolor})

noClusters = np.max(clusters).item() + 1
clusterData = pd.DataFrame(columns=['col', 'row', 'min', 'mean', 'max'])

maximum = np.amax([d['max'] for d in distributionMapData])
minimum = np.amin([d['min'] for d in distributionMapData])

distributionMapData = pd.DataFrame(distributionMapData)
distributionMapData = pd.concat([distributionMapData], ignore_index=True)

distributionMap(distributionMapData, clusters, size, columns, minimum, maximum, plottype)

 plotDistributionOfDataInClusters(som, data, columns[:-1], plottype='barpolar')

from minisom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.