kohonen | A basic implementation of a Kohonen map in JavaScript | Artificial Intelligence library
kandi X-RAY | kohonen Summary
kandi X-RAY | kohonen Summary
A basic implementation of a Kohonen map in JavaScript. Disclaimer: this is a toy implementation of the SOM algorithm, you should probably consider using a more solid library in R or Python.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of kohonen
kohonen Key Features
kohonen Examples and Code Snippets
Community Discussions
Trending Discussions on kohonen
QUESTION
I am stuck in a problem, I am trying to apply SOM analysis using the kohonen package in R. The dataset I am using is a gene expression dataframe. I am using the code given below,
...ANSWER
Answered 2022-Jan-06 at 21:34Using data(wines)
as an example.
som.wines <- som(scale(wines), grid = somgrid(5, 5, "hexagonal"))
Each big circle in your plot is a cluster of samples found in the data by rows.
The profiles of the clusters are stored in som.wines$codes
. Each line here is a cluster, V1 - Vx. This corresponds, obviously, to the number of big circles. You find the associated rows, i.e. the original data, in som.wines$unit.classif
.
Associate the clusters with your original data with
QUESTION
I'm trying to run some and k means analysis. But I can't solve it because there's an error code.
...Error in storage.mode(x) <- "double" : 'list' object cannot be coerced to type 'double'
ANSWER
Answered 2021-Dec-11 at 13:37You should coerce the object to a matrix or a data frame.
From the kmeans()
documentation:
x = numeric matrix of data, or an object that can be coerced to such a matrix (such as a numeric vector or a data frame with all numeric columns)
QUESTION
So, it's my first time trying to make my own data visualization, and what I want to do is something like a heat map or highlighted table like the original Kohonen (but using squares rather than hexagons) research about countries, but I don't know how to apply it to the map I've got from training the network.
I've read a few links about making a highlighted table and heat map on Tableau, but what I get is always just a table mainly because I'm not using a measure (i just want every country of one color), so, my question is: is it possible to use Tableau for this situation and if so, how could I do it? Thanks!
...ANSWER
Answered 2021-Nov-12 at 17:57Yes it is possible to make visualizations like you describe in Tableau - but the question you posed is a bit vaguely specified to give you much more detailed guidance than first take some Tableau training.
For instance, how do you want to determine which row and column to place a country? You may need to write a table calc for row and col positions, which means learning about table calcs. Or you can assign them in a data column.
For square country marks, you'll want a discrete field on the rows shelf, a discrete field on the columns shelf, possible a dimension like Country name on the details shelf. Choose a square mark type, and (important) choose a square cell size from the format menu. Then adjust the size of your squares from the size button and the format menu, and colors and borders from the color button and format pane.
Lots to play with.
QUESTION
I am using the following code which performs the SOM (Self Organizing Map, also called the Kohonen Network) machine learning algorithm to visualize some data. Then, I use a clustering algorithm (I select 8 clusters) on the visualization:
...ANSWER
Answered 2021-Mar-05 at 00:23Replace somClusters
with clusters
in the definition of the background color in the last plot. The main issue is that you defined somClusters
to have three values, not 8. If you use that to index the vector of colors, it will only have three colors.
QUESTION
I am following the tutorial over here : https://www.rpubs.com/loveb/som . This tutorial shows how to use the Kohonen Network (also called SOM, a type of machine learning algorithm) on the iris data.
I ran this code from the tutorial:
...ANSWER
Answered 2021-Jan-26 at 17:11From what I can see, using iris.som$unit.classif
& iris.som$grid
is the way to go in isolating circles within the plotting grid. I have made an assumption that the classifier value matches the row index of iris.som$grid
so this will need some more validation. Let me know if this helps your problem :)
QUESTION
I am using the R programming language. I am trying to arrange "plot1, plot2, plot3, plot4" on the same page:
...ANSWER
Answered 2021-Jan-21 at 18:15It looks like you are dealing with the base plot system in R, and assigning the plots to variables does not generate anything (e.g. plot1 is NULL
). You can use layout
to split the graphics area into subsections and then plot the individual plots into those:
QUESTION
In Databricks (SparkR
), I run the batch algorithm of the self-organizing map in parallel from the kohonen
package as it gives me considerable reductions in computation time as opposed to my local machine. However, after fitting the model I would like to download/export the trained model (a list
) to my local machine to continue working with the results (create plots etc.) in a way that is not available in Databricks. I know how to save & download a SparkDataFrame
to csv:
ANSWER
Answered 2021-Jan-21 at 00:21If all your models can fit into the driver's memory, you can use spark.lapply
. It is a distributed version of base lapply
which requires a function and a list. Spark will apply the function to each element of the list (like a map) and collect the returned objects.
Here is an example of fitting kohonen models, one for each iris species:
QUESTION
I am learning about the "kohonen" package in R for the purpose of making Self Organizing Maps (SOM, also called Kohonen Networks - a type of Machine Learning algorithm). I am following this R language tutorial over here: https://www.rpubs.com/loveb/som
I tried to create my own data (this time with both "factor" and "numeric" variables) and run the SOM algorithm (this time using the "supersom()" function instead):
...ANSWER
Answered 2021-Jan-20 at 02:15getCodes()
produces a list and as such you have to treat it like one.
Calling getCodes(som)
produces a list containing 7 items named a-g as such you should be selecting items from the list either using $
or [[]]
e.g
QUESTION
I am trying to learn about the "kohonen" package in R. In particular, there is a function called "supersom()" (https://www.rdocumentation.org/packages/kohonen/versions/3.0.10/topics/supersom , corresponding to the SOM (Self Organizing Maps) algorithm used in unsupervised machine learning) that I am trying to apply on some data.
Below, (from a previous question: R error: "Error in check.data : Argument Should be Numeric") I learned how to apply the "supersom()" function on some artificially created data with both "factor" and "numeric" variables.
...ANSWER
Answered 2021-Jan-18 at 01:35The error happens if you have certain numeric columns whose mean is 0. You can reproduce the error by turning any 1 column to 0.
QUESTION
I am learning about the "kohonen" library for the R programming language. I created some artificial data to try some of the functions on. I tried using the "supersom()" function on only continuous (i.e type = as.numeric) data and everything works well. However, when I tried to run the "supersom()" function on both continuous and categorical (type = as.factor), I start to run into some errors ("Argument data should be numeric").
The "supersom()" function has an argument called "dist.fct" (distance function) which allows the user to specify which type of "distance" (e.g. "Euclidean" for continuous, "tanimoto" for categorical) should be used for different columns. I created a data set with 4 continuous variables and 3 categorical variables. Using the following link : https://www.rdocumentation.org/packages/kohonen/versions/2.0.5/topics/supersom , I tried to run the example:
...ANSWER
Answered 2021-Jan-17 at 06:01If you keep factor or character data in a matrix it will turn all other values of matrix to character since a matrix can have data of only one type. Keep only numeric data in the matrix or convert each column to a list.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install kohonen
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page