Reputation: 25
I am trying the Machine Learning tutorial on Kaggle
When they do it, they get the output as: Kaggle outupt
This is my code:
import pandas as pd
pd.set_option('display.max_rows', 5000)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
# Read file from source
data = pd.read_csv(r"C:\Users\harsh\Documents\My Dream\Desktop\Machine Learning\melb_data.csv", skiprows=0)
data = data.dropna(axis=0)
# Column that you want to predict = y
y = data.Price
# Columns that are inputted into the model to make predictions (dependants)
data_features = ['Rooms', 'Bathroom', 'Landsize', 'Lattitude', 'Longtitude']
X = data[data_features]
from sklearn.tree import DecisionTreeRegressor
# Define model. Specify a number for random_state to ensure same results each run
data_model = DecisionTreeRegressor(random_state=1)
# Fit model
data_model.fit(X, y)
My output is just
Process finished with exit code 0
Whenever I want any output in the Run area, I have to put the function in print()
My question predominantly is:
How do I get the output as the Kaggle output in my PyCharm? Have I configured the IDE correctly?
Why do I need to put the print()
function to display results every time? Do I need to do this svery time?
With print(), I get the output as:
DecisionTreeRegressor(random_state=1)
What am I missing?
I am using PyCharm 2019.2.6 and Python 3.7 configuration
Upvotes: 0
Views: 43
Reputation: 2126
Sklearn is not printing out the model parameters. You can print the DecisionTreeRegressor
parameters with print(data_model.get_params())
Upvotes: 1