Git Product home page Git Product logo

rajat-dhyani / charity_donors Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 3.0 710 KB

In this project i used many supervised learning algorithms available in scikit-learn, and also provided a method of evaluating, just how each model works and performs on a certain type of data.

Jupyter Notebook 28.22% HTML 70.97% Python 0.81%
adaboost knearest-neighbor-algorithm machine-learning numpy pandas python randomforest scikit-learn supervised-learning-algorithms

charity_donors's People

Contributors

rajat-dhyani avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

charity_donors's Issues

Issue with "evaluate" fuction.

Hi sir. I could not preform the visualization for the performance matrix. It is showing me error:

Import the three supervised learning models from sklearn

from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.neighbors import KNeighborsClassifier

Initialize the three models

clf_A = RandomForestClassifier(random_state = 50)
clf_B = AdaBoostClassifier(random_state = 50)
clf_C = KNeighborsClassifier()

Calculate the number of samples for 1%, 10%, and 100% of the training data

samples_1 = X_train.shape[0] * 1/100
samples_1 = math.trunc(samples_1)
samples_10 = X_train.shape[0] * 10/100
samples_10= math.trunc(samples_10)
samples_100 = X_train.shape[0] * 100/100
samples_100 = math.trunc(samples_100)

#print samples_1," ",samples_10," ",samples_100," "

Collect results on the learners

results = {}
for clf in [clf_A,clf_B,clf_C]:
clf_name = clf.class.name
results[clf_name] = {}
for i, samples in enumerate([samples_1, samples_10, samples_100]):
results[clf_name][i] = train_predict(clf, samples, X_train, y_train, X_test, y_test)

Run metrics visualization for the three supervised learning models chosen

vs.evaluate(results, accuracy, fscore)

RandomForestClassifier trained on 361 samples.
RandomForestClassifier trained on 3617 samples.
RandomForestClassifier trained on 36177 samples.
AdaBoostClassifier trained on 361 samples.
AdaBoostClassifier trained on 3617 samples.
AdaBoostClassifier trained on 36177 samples.
KNeighborsClassifier trained on 361 samples.
KNeighborsClassifier trained on 3617 samples.
KNeighborsClassifier trained on 36177 samples.

IndexError Traceback (most recent call last)
in
28
29 # Run metrics visualization for the three supervised learning models chosen
---> 30 vs.evaluate(results, accuracy, fscore)

~\Downloads\charity_donors-master\charity_donors-master\visuals.py in evaluate(results, accuracy, f1)
73
74 # Creative plot code
---> 75 ax[j/3, j%3].bar(i+k*bar_width, results[learner][i][metric], width = bar_width, color = colors[k])
76 ax[j/3, j%3].set_xticks([0.45, 1.45, 2.45])
77 ax[j/3, j%3].set_xticklabels(["1%", "10%", "100%"])

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.