ilarinieminen / SOM-Toolbox

GNU General Public License v2.0
120 stars 57 forks source link

[Error! in setting labels] Length of 'labels' must be equal to the number of data vectors. #7

Open dbl001 opened 9 years ago

dbl001 commented 9 years ago

I am getting errors in:

sD = som_data_struct(D,'labels', labels, 'comp_names',headers);

and

sD = som_normalize(sD,'range'); % scale between 0 and 1

I assume it is because of how my data is organized: in row vectors. The data is from the Global Events Database: GDELT.

Here's a few sample rows - it has 58 features in columns and few sample rows.

E.g. - GLOBALEVENTID SQLDATE MonthYear Year FractionDate Actor1Code Actor1Name Actor1CountryCode Actor1KnownGroupCode Actor1EthnicCode Actor1Religion1Code Actor1Religion2Code Actor1Type1Code Actor1Type2Code Actor1Type3Code Actor2Code Actor2Name Actor2CountryCode Actor2KnownGroupCode Actor2EthnicCode Actor2Religion1Code Actor2Religion2Code Actor2Type1Code Actor2Type2Code Actor2Type3Code IsRootEvent EventCode EventBaseCode EventRootCode QuadClass GoldsteinScale NumMentions NumSources NumArticles AvgTone Actor1Geo_Type Actor1Geo_FullName Actor1Geo_CountryCode Actor1Geo_ADM1Code Actor1Geo_Lat Actor1Geo_Long Actor1Geo_FeatureID Actor2Geo_Type Actor2Geo_FullName Actor2Geo_CountryCode Actor2Geo_ADM1Code Actor2Geo_Lat Actor2Geo_Long Actor2Geo_FeatureID ActionGeo_Type ActionGeo_FullName ActionGeo_CountryCode ActionGeo_ADM1Code ActionGeo_Lat ActionGeo_Long ActionGeo_FeatureID DATEADDED SOURCEURL 440612069 20140613 201406 2014 2014.4466 AFR AFRICA AFR 0 36 36 3 1 4 2 1 2 4.945781539 0 1 South Africa SF SF -29 24 SF 1 South Africa SF SF -29 24 SF 20150613 http://www.thisdaylive.com/articles/precious-chikwendu-my-man-means-everything-to-me-i-ll-not-kiss-any-actor-romantically-in-a-movie/211846/ 440612070 20140613 201406 2014 2014.4466 CAN ONTARIO CAN 1 30 30 3 1 4 56 7 56 -6.76019676 0 4 Lake Erie, Canada (general), Canada CA CA00 42 -81 -564290 4 Lake Erie, Canada (general), Canada CA CA00 42 -81 -564290 20150613 http://www.timesleaderonline.com/page/content.detail/id/866436/APNewsBreak--States-to-cut-pollutants-behind-Lake-Erie-algae.html?isap=1&nav=5019 440612071 20140613 201406 2014 2014.4466 CVL NEIGHBORHOOD CVL 1 46 46 4 1 7 10 1 10 0.149700599 0 3 Phoenix, Arizona, United States US USAZ 33.4484 -112.074 44784 3 Phoenix, Arizona, United States US USAZ 33.4484 -112.074 44784 20150613 http://www.azcentral.com/story/news/local/chandler/2015/06/12/older-buildings-chandler-floats-idea/71151120/ 440612072 20140613 201406 2014 2014.4466 EDU SCHOOL EDU 1 36 36 3 1 4 5 1 5 -2.413793103 0 3 Chicago, Illinois, United States US USIL 41.85 -87.6501 423587 3 Chicago, Illinois, United States US USIL 41.85 -87.6501 423587 20150613 http://www.uexpress.com/sense-and-sensitivity/2015/6/12/reader-dreads-brother-moving-in-with [Error! in setting labels] Length of 'labels' must be equal to the number of data vectors. [Error! in setting comp_names] Length of 'comp_names' should be equal to dim. Attempted to access p(1); index out of bounds because numel(p)=0.

Error in som_norm_variable>norm_scale_do (line 357) x = (x - p(1)) / p(2);

Error in som_norm_variable (line 299) case 'range', x = norm_scale_do(x,sNorm(i).params);

Error in som_normalize (line 294) [x,sN] = som_norm_variable(D(:,i), csNorm{i}, 'do');

Error in SOTM (line 18) sD = som_normalize(sD,'range'); % scale between 0 and 1