Comments (2)
Hi @Sarwat-Fatima ,
That's the accuracy score which is normalized i.e between the value from 0-1, where 0 means none of the output were accurate and 1 means every prediction was accurate.
You should not be multiplying with number of observations directly. 0.96666667 means 96% of your observations are correctly predicted.
If you want to know how many observations were correctly predicted, just pass normalize=False as show in the example http://scikit-learn.org/stable/modules/generated/sklearn.metrics.accuracy_score.html
accuracy_score(y_true, y_pred, normalize=False)
@justmarkham , This is really a nice piece of tutorial series you have prepared for beginners. Thanks for that.
from scikit-learn-videos.
@Sarwat-Fatima I assume you are asking about the output from this code:
knn = KNeighborsClassifier(n_neighbors=5)
scores = cross_val_score(knn, X, y, cv=10, scoring='accuracy')
print scores
print scores.mean()
In this case, there are 150 response values in the y
object. Since this is 10-fold cross-validation, each iteration of cross-validation involves predicting 15 response values. A score of "1" means 15 of 15 were predicted correctly, a score of 0.9333 means 14 of 15 were predicted correctly, etc.
The 0.9666 number is the average of those 10 scores. You can multiply it by 150 and get 145, meaning 145 response values were correctly predicted.
I think you were confused by code in the notebook that showed an example dataset in which there were 25 observations. The relevant data actually had 150 observations.
Hope that helps!
@deepish Thanks for your kind words, I'm glad you like the video series!
from scikit-learn-videos.
Related Issues (11)
- Self-Organizing Maps in Scikit Learn HOT 1
- type error HOT 2
- Issue with skvideo.io
- headers in Advertising.csv have changed HOT 2
- 09_classification_metrics.ipynb data URL spioled HOT 1
- Show accuracy HOT 3
- Notebook links broken? HOT 1
- in 09_classification_metrics HOT 1
- Confusion Matrix setup in scikit-learn HOT 1
- Error: 'unable to contact kernel' on Jupyter 3.2.x + HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scikit-learn-videos.