新的小问题:现在试着测试我的代码,但我得到了一个错误。
java.lang.NullPointerException
at DecisionTree.TestTree.main(TestTree.java:6)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(U
我已经建立了一个使用决策树和随机森林的模型。但是,当我试图在同一个DataFrame上测试模型时,输出是不同的。这怎麽可能?
我回购的数据文件:
#This is the function to help me preparing the dataframe
def process_df_for_ml(df):
"""
Process a dataframe for model training/prediction use.
Returns X/y tensors.
"""
df = df.copy(
我有一个带有相应categoricalFeaturesInfo的功能集: MapInt,Int。然而,对于我来说,我不知道我应该如何让DecisionTree类工作。它不接受任何东西,只接受LabeledPoint作为数据。但是,LabeledPoint需要(double,向量),其中向量需要双精度。
val LP = featureSet.map(x => LabeledPoint(classMap(x(0)),Vectors.dense(x.tail)))
// Run training algorithm to build the model
val maxDepth: Int
我试图运行MLLIB的随机森林模型,并获得一些超出界限的异常:
15/09/15 01:53:56 INFO scheduler.DAGScheduler: ResultStage 5 (collect at DecisionTree.scala:977) finished in 0.147 s
15/09/15 01:53:56 INFO scheduler.DAGScheduler: Job 5 finished: collect at DecisionTree.scala:977, took 0.161129 s
15/09/15 01:53:57 INFO rdd.MapPartiti
我正在使用decision tree(supervised learning)在电信行业进行churn预测(客户是否转移到另一家公司)。我有一个结构如下的数据集(csv数据):
number vmail messages,total call minutes,total number of calls,total call charge,number of customer service calls,churn
其中,最后一列(churn)是true或false值列,用作标签。在测试期间,我希望预测该列的值( true-false或0-1)。我的疑问是,如何使用Spark MLlibs de
我使用管道模块在火花放电中实现DecisionTreeClassifier,因为我有几个特性工程步骤要在我的数据集上执行。代码类似于星火文档中的示例:
from pyspark import SparkContext, SQLContext
from pyspark.ml import Pipeline
from pyspark.ml.classification import DecisionTreeClassifier
from pyspark.ml.feature import StringIndexer, VectorIndexer
from pyspark.ml.evaluation
我正在尝试使用Scala在Spark中训练一个带有DecisionTree的模型。
我的代码如下:
val numClasses = 19413
val categoricalFeaturesInfo = Map[Int, Int](5 -> 14)
val impurity = "gini"
val maxDepth = 5
val maxBins = 23000
val model = DecisionTree.trainClassifier(trainData, numClasses, categoricalFeaturesInfo, impurity, maxD
下面是我得到的错误:
我知道它告诉我a.setAttribute(0);是错误的,但我不知道为什么它是错误的。我应该如何用值填充实例数组?
java.lang.NullPointerException
at DecisionTree.TestTree.main(TestTree.java:6)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.ref
我正试着为一个游戏做一个决定树,我有:
data DecisionTree a
= Result a
| Decision [DecisionTree a]
deriving (Eq,Show)`
此外,我还有
instance Functor DecisionTree where
fmap = liftM
现在我要定义一下
instance Monad DecisionTree where
-- return :: a -> DecisionTree a
return = ...
-- (>>=) :: DecisionTree a ->
我正在为我的网站使用codeigniter v3,我在从一个页面重定向到另一个页面时遇到了问题。
如果我单击该选项卡,该链接将显示localhost:8080/IDS/view/decisiontree和Object not found! The requested URL was not found on this server...
如果我编辑URL并将其设置为localhost:8080/IDS/index.php/view/decisiontree,则站点可以完美地加载。
以下是我的路线:
$route['view/decisiontree'] = 'data_
我正在使用决策树算法,我得到了以下错误。我有500多个特性。这有问题吗?任何帮助都是最好的!
java.lang.UnknownError: no bin was found for continuous variable.
at org.apache.spark.mllib.tree.DecisionTree$.findBin$1(DecisionTree.scala:492)
at org.apache.spark.mllib.tree.DecisionTree$.org$apache$spark$mllib$tree$DecisionTree$$findBinsForLe
我有一个非常简单的示例脚本:
using Pkg
Pkg.add("DecisionTree")
Pkg.add("DataFrames")
using DataFrames
using DecisionTree
dat = DataFrame(A=[1, 2, 3, 4, 5], B=[2, 5, 1, 2, 6])
model = build_tree(dat[!, "A"], dat[!, "B"])
返回一个错误:
ERROR: LoadError: MethodError: no method matching bu
我正在研究数据,在这些数据中,我尝试了不同的分类算法,并看看哪种算法作为基线模型的性能最好。这方面的代码如下:
# Trying out different classifiers and selecting the best
## Creat list of classifiers we're going to loop through
classifiers = [
KNeighborsClassifier(),
SVC(),
DecisionTreeClassifier(),
RandomForestClassifier(),
AdaBo
我正在研究一个二进制分类模型,分类器是朴素贝叶斯。我有一个几乎平衡的数据集,但是当我预测时会得到以下错误消息:
UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples.
'precision', 'predicted', average, warn_for)
我正在使用gridsearch和CV k-折叠10。测试集和预测包含两个类,所以我不理解这个信息。我工作在相同的数据集,培