第一个问题 Error Message
Not enough memory. Please load a smaller dataset or use larger heap size.
原因:
This error message appears when a user attempts to load or process a dataset that WEKA can not handle with the used heap size.
解决方案:
The Java heap size can be specified with the -Xmx option.
Let the classpath that contains a JAR file (weka.jar) be:
C:/Matlab/weka-3-5-7/
E.g., to use 256MB as heap size, the command line looks like this:
C:/Matlab/weka-3-5-7>java -Xmx256m -jar weka.jar
第二个问题 weka的StringToWordVector类解析
weka的StringToWordVector类可以将给定的文档格式的内容转换为vms模型的内容,而后者是文本分类必须的模块。按照weka要求,生成arff格式的文本:
- @relation D__java_weka_data
- @attribute text string
- @attribute class {test1,test2,test3}
- @data
- 'here we go go go go to do ',test1
- 'Mostly, I expect we are interested in indexing XPath queries',test1
- 'so what do you think you can do anything?',test2
- 'Sparse ARFF files are very similar to ARFF files',test3
按照StringToWordVector类的命令格式,设定options:
- String[] options = { "-C", "-T", "-i", "data//train.arff", "-o","data//res_train.arff", "-c", "last"};
生成结果如下:
- @relation 'D_java_weka_data-weka.filters.unsupervised.attribute.StringToWordVector-R1-W1000-prune-rate-1.0-C-T-N0-stemmerweka.core.stemmers.NullStemmer-M1-tokenizerweka.core.tokenizers.WordTokenizer -delimiters \" \\r\\n\\t.,;:\\\'\\\"()?!\"'
- @attribute class {test1,test2,test3}
- @attribute I numeric
- @attribute Mostly numeric
- @attribute XPath numeric
- @attribute are numeric
- @attribute do numeric
- @attribute expect numeric
- @attribute go numeric
- @attribute here numeric
- @attribute in numeric
- @attribute indexing numeric
- @attribute interested numeric
- @attribute queries numeric
- @attribute to numeric
- @attribute we numeric
- @attribute anything numeric
- @attribute can numeric
- @attribute so numeric
- @attribute think numeric
- @attribute what numeric
- @attribute you numeric
- @attribute ARFF numeric
- @attribute Sparse numeric
- @attribute files numeric
- @attribute similar numeric
- @attribute very numeric
- @data
- { 5 0.693147,7 1.609438,8 0.693147,13 0.693147,14 0.693147}
- { 1 0.693147,2 0.693147,3 0.693147,4 0.693147,6 0.693147,9 0.693147,10 0.693147,11 0.693147,12 0.693147,14 0.693147}
- { 0 test2,5 1.098612,15 0.693147,16 0.693147,17 0.693147,18 0.693147,19 0.693147,20 1.098612}
- { 0 test3,4 0.693147,13 0.693147,21 1.098612,22 0.693147,23 1.098612,24 0.693147,25 0.693147}
属性评估方法:
CfsSubsetEval:根据属性子集中每一个特征的预测能力以及它们之间的关联性进行评估。 ChiSquaredAttributeEval:根据与分类有关的每一个属性的卡方值进行评估。 ClassifierSubsetEval:根据训练集或测试集之外的数据评估属性子集。
ConsistencySubsetEval:根据利用属性子集进行分类时得到的分类值的一致性进行评价。 CostSensitiveAttributeEval:根据使其基础子集评估开销敏感性,变化选择子集评估方法。 CostSentitiveSubsetEval:方法同上。
FilteresAttributeEval:运行在任意过滤器之后的数据上的任意属性评估。 FilteredSubsetEval:方法同上。
GainRatioAttributeEval:根据与分类有关的每一个属性的增益比进行评估。 InfoGainAttributeEval:根据与分类有关的每一个属性的信息增益进行评估。
LatenSemanticAnalysis:根据数据的潜在的语义分析和转换进行评估,与随机搜索结合。 OneRAttributeEval:根据OneR分类器评估属性。
PrincipalComponents:根据数据的主要成分分析和转换进行评估。
ReliefFAttributeEval:通过反复测试一个实例和其同类或不同类中最近的实例上的属性值进行评估。
SignificanceAttributeEval:计算双向功能的概率意义评估属性值。
SymmetricalUncertAtrributeEval:根据与分类有关的每一个属性的对称不稳定性进行评估。 SymmetricalUncertAtrributeSetEval:根据与其他属性集有关的每一个属性的对称不稳定性进行评估。
WrapperSubsetEval:使用一种学习模式对属性集进行评估。
注:Filter类型的评估方法关注每一个属性的预测能力(最优特征子集由预测能力最强的那些单个属性组成),其一般借鉴统计、信息论的思想,根据数据集内在特性来进行评估; Wrapper类型的评估方法是用后续的学习算法嵌入到特性选择方程中,通过测试特征子集在此算法上的预测性能来决定其优劣。
搜索算法:
BestFirst:可回溯的贪婪搜索扩张,最好优先原则。 ExhaustiveSearch:穷举搜索,从空集出发。
FCBFSearch:基于相关性分析的特征选择方法。相关性匹配搜索。 GeneticSearch:Goldberg(1989)提出的简单遗传算法。 GreedyStepwise:向前或向后的单步搜索。 LinearForwardSelection:线性向前搜索。
RaceSearch:比较特征子集的交叉验证错误情况。 RandomSearch:随机搜索。 Ranker:对属性值排序。
RankSearch:选择一个评估器对属性进行排序。 ScatterSearchV1:离散搜索。
SubsetSizeForwardSelection:按照特征子集大小向前线性搜索,这是线性搜索的扩展。 TabuSearch:禁忌搜索。
第四个问题