decision-tree

in R: Error in is.data.frame(data) : object '' not found, C5.0 plot

点点圈 提交于 2019-12-05 11:44:14
This question is similar to some other questions on Stackoverflow ( here , here and here ), but different enough so that I cannot extrapolate those answers to my case. I have a function in which I fit a C5.0 model and than try to plot the model. train_d <- globald[train_ind,c(features,21)] model <- C5.0(binclass ~ .,data=train_d,trials=10) binclass is a column name in my training/test data (globald is a dataframe from which I subset rows with _ind indices and columns c(3:12,21) , where column 21 is named binclass ). Fitting works well. However, when I also add the line plot(model,trial=0) then

How do I visualise / plot a decision tree in Apache Spark (PySpark 1.4.1)?

眉间皱痕 提交于 2019-12-05 11:05:42
I am using Apache Spark Mllib 1.4.1 (PySpark, the python implementation of Spark) to generate a decision tree based on LabeledPoint data I have. The tree generates correctly and I can print it to the terminal (extract the rules as this user calls it How to extract rules from decision tree spark MLlib ) using: model = DecisionTree.trainClassifier( ... ) print(model.toDebugString() But what I want to do is visualize or plot the decision tree rather than printing it to the terminal. Is there any way I can plot the decision tree in PySpark or maybe I can save the decision tree data and use R to

decision tree in R error:fit is not a tree,just a root

最后都变了- 提交于 2019-12-05 07:10:54
good afternoon! I have problem with a decisional trees. f11<-as.factor(Z24train$f1) fit_f1 <- rpart(f11~TSU+TSL+TW+TP,data = Z24train,method="class") plot(fit_f1, uniform=TRUE, main="Classification Tree for Kyphosis") But this error appears: Error in plot.rpart(fit_f1, uniform = TRUE, main = "Classification Tree for Kyphosis") : fit is not a tree, just a root which is the problem? thanks for the help :) navo This is probably due to RPART is not being able to create a decision tree with the given data set after using it's default control parameters. rpart.control(minsplit = 20, minbucket =

Feature importances - Bagging, scikit-learn

 ̄綄美尐妖づ 提交于 2019-12-05 05:50:11
For a project I am comparing a number of decision trees, using the regression algorithms (Random Forest, Extra Trees, Adaboost and Bagging) of scikit-learn. To compare and interpret them I use the feature importance , though for the bagging decision tree this does not look to be available. My question: Does anybody know how to get the feature importances list for Bagging? Greetings, Kornee Are you talking about BaggingClassifier? It can be used with many base estimators, so there is no feature importances implemented. There are model-independent methods for computing feature importances (see e

Inference engines vs Decision trees [closed]

别来无恙 提交于 2019-12-05 05:13:43
I am using an expert system with an inference engine (forward chaining) and I would like to explain why it is better than a decision tree using very simple concepts. (in one particular situation) I know there is a similar question on stackoverflow but it's not the answer I'm looking for. Here is my problem: For Customer Relation Management, I am using lot of different business rules (that induce dialog rules) to help the customer make a decision on one product. Note: Rules are added frequently (2 per days). The customer answers a series of questions before getting his answer. The business

How to plot/visualize a C50 decision tree in R?

和自甴很熟 提交于 2019-12-05 05:12:47
I am using the C50 decision tree algorithm. I am able to build the tree and get the summaries, but cannot figure out how to plot or viz the tree. My C50 model is called credit_model In other decision tree packages, I usually use something like plot(credit_model). In rpart it is rpart.plot(credit_model). What is the equivalent in the C50 algorithm to plot? Right now, there are none built in. I've been working on an adapter for the partykit package (e.g. as.party ) but have not gotten very far. Max You can use the following routine, to directly convert the decision tree into GraphViz dot

pydot: is it possible to plot two different nodes with the same string in them?

岁酱吖の 提交于 2019-12-05 03:36:21
I'm using pydot in order to draw graphs in python. I'd like to represent a decision tree, say something like (a1,a2,a3 are attributes and two classes are 0 and 1: a1>3 / \ a2>10 a3>-7 / \ / \ 1 0 1 0 However, using pydot, only two leaves are created and the tree looks like this (png attached): a1>3 / \ a2>10 a3>-7 | X | 1 0 Now, in this simple case the logic is fine but in larger trees it is messy internal nodes belonging to different branches are unified. The simple code I'm using is: import pydot graph = pydot.Dot(graph_type='graph') edge = pydot.Edge("a_1>3", "a_2>10") graph.add_edge(edge)

How to retrieve class values from WEKA using MATLAB

﹥>﹥吖頭↗ 提交于 2019-12-04 23:54:10
问题 I'm trying to retrieve classes from WEKA using MATLAB and WEKA API. All looks fine but classes are always 0. Any idea ?? My data set has 241 atributes, applying WEKA to this dataset I'm obtaining correct results. 1st train and test objects are created than classifier is build and classifyInstance performed. But this give wrong result train = [xtrain ytrain]; test = [xtest]; save ('train.txt','train','-ASCII'); save ('test.txt','test','-ASCII'); %## paths WEKA_HOME = 'C:\Program Files\Weka-3-7

rpart node assignment

纵饮孤独 提交于 2019-12-04 17:02:10
Is it possible to extract the node assignment for a fitted rpart tree? What about when I apply the model to new data? The idea is that I would like to use the nodes as a way to cluster my data. In other packages (e.g. SPSS), I can save the predicted class, probabilities, and node number for further analysis. Given how powerful R can be, I imagine there is a simple solution to this. topepo Try using the partykit package: library(rpart) z.auto <- rpart(Mileage ~ Weight, car.test.frame) library(partykit) z.auto2 <- as.party(z.auto) predict(z.auto2, car.test.frame[1:3,], type = "node") # Eagle

how to get all terminal nodes - weight & response prediction 'ctree' in r

你说的曾经没有我的故事 提交于 2019-12-04 14:13:12
Here's what I can use to list weight for all terminal nodes : but how can I add some code to get response prediction as well as weight by each terminal node ID : say I want my output to look like this -- Here below is what I have so far to get the weight nodes(airct, unique(where(airct))) Thank you The Binary tree is a big S4 object, so sometimes it is difficult to extract the data. But the plot method for BinaryTree object, hase an optional panel function of the form function(node) plotting the terminal nodes. So when you plot you can get all the informations about this node. here I use the