in the column "eval" I insert an index from 1 to 3 (1= not interesting, 2=not bad ,3= interesting).
This table is used to train our model as done below:
The slqalchemy engine is created and directly passed as parameter in the pandas function pandas.read_sql().
The variables x and y are used to generate the training and the test data(without further parameter, the data are randomly splitted as 75% of data for training and 25% as test data).
With that we are able to create our model.
The model is provided from the library scikit-learn where the DecisionTreeClassifier is what I was looking for.
With the trained model we can feed it using the whole dataset to obatain the parameter "eval" for each house.
The script below is commented to clarify each step.
At the end some interesting houses (eval = 3) obtained from my model.

No comments:
Post a Comment