Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can u add an example where we can use the data in numpy for the generated "tpot_mnist_pipeline.py" #114

Closed
anjith2006 opened this issue Mar 17, 2016 · 4 comments
Labels

Comments

@anjith2006
Copy link

In the example MNIST, the generated python code is not directly usable for evaluation with the original
data.
Can you post an example were I can directly use the scikit type , or simply numpy arrays for data and labels.

@rhiever
Copy link
Contributor

rhiever commented Mar 17, 2016

Do you mean this example? Here's an example of that code transforming the data from load_digits() into pandas DataFrame format.

import numpy as np
import pandas as pd

from sklearn.cross_validation import StratifiedShuffleSplit
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import load_digits

digits = load_digits()

tpot_data = pd.DataFrame(digits.data)
tpot_data['class'] = digits.target

training_indeces, testing_indeces = next(iter(StratifiedShuffleSplit(tpot_data['class'].values, n_iter=1, train_size=0.75, test_size=0.25)))

result1 = tpot_data.copy()

# Perform classification with a logistic regression classifier
lrc1 = LogisticRegression(C=2.8214285714285716)
lrc1.fit(result1.loc[training_indeces].drop('class', axis=1).values, result1.loc[training_indeces, 'class'].values)
result1['lrc1-classification'] = lrc1.predict(result1.drop('class', axis=1).values)

@pronojitsaha
Copy link
Contributor

Hey @rhiever , we need to change the StratifiedShuffleSplit to train_test_split in the above tpot example as well.

@rhiever
Copy link
Contributor

rhiever commented Mar 17, 2016

Sure, submit the PR? :-)

On Thursday, March 17, 2016, PRONOjit Saha notifications@github.com wrote:

Hey @rhiever https://github.com/rhiever , we need to change the
StratifiedShuffleSplit to train_test_split in the above tpot example as
well.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#114 (comment)

Randal S. Olson, Ph.D.
Postdoctoral Researcher, Institute for Biomedical Informatics
University of Pennsylvania

E-mail: rso@randalolson.com | Twitter: @randal_olson
https://twitter.com/randal_olson
http://www.randalolson.com

@pronojitsaha
Copy link
Contributor

OK...will look into it and send across the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants