1

I am trying to solve a regression problem using the decision tree algorithm where I want to know the mathematics lies in the odt file which is generated after saving the trained model. Here, I want to mention that none of the value of the variable is categorical here.

I have gone through this, this but their values are categorical.

The code I have written for this purpose is given below:

from sklearn import *
import numpy as np
import sklearn

data = [[2,5,1,10],[3,7,2,12],[5,9,4,14],[6,3,3,16],[2,5,8,7],[1,1,1,1]]

data = np.array(data)
type(data)

data

feature = data[:,:-1]
target = data[:,-1]
target = np.reshape(target,(-1,1))

model_tree = sklearn.tree.DecisionTreeRegressor()
model_tree.fit(feature, target)

import graphviz
dot_data = tree.export_graphviz(model_tree, out_file='manual_1.dot')


I have given here the graph which I have got from the saved odt file.

user10634362
  • 549
  • 5
  • 21

0 Answers0