Link to home
Create AccountLog in
Python

Python

--

Questions

--

Followers

Top Experts

Avatar of kalyangkm
kalyangkmπŸ‡ΊπŸ‡Έ

NameError: name 'DecisionTreeClassfier' is not defined
Hi,

I am using Jupyter notebook for the some basic machine learning code developed in python. I am stangely getting the following error. Even though I have imported the class "DecisionTreeClassifier" as shown in the code I am still getting the error "NameError: name 'DecisionTreeClassfier' is not defined" when I try to instantiate the class as follows. PFA is the screenshot for error message.

import pandas as pd
from sklearn.tree import DecisionTreeClassifier

music_data = pd.read_csv('music.csv')
X = music_data.drop(columns = ['genre'])
y = music_data['genre']
music_data

model = DecisionTreeClassfier()
#model.fit(X, y)
#predictions = model.predict([ [21, 1], [20, 0] ])
#predictions

Open in new window

Screen-Shot-2020-05-04-at-11.11.01-P.png

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of Louis LIETAERLouis LIETAERπŸ‡«πŸ‡·

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of kalyangkmkalyangkmπŸ‡ΊπŸ‡Έ

ASKER

Thank You.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

Python

Python

--

Questions

--

Followers

Top Experts

Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in other languages. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive set of standard libraries, including NumPy, SciPy, Django, PyQuery, and PyLibrary.