<jupyter_start><jupyter_text>Read the CSV and Perform Basic Data Cleaning<jupyter_code>df = pd.read_csv("exoplanet_data.csv")
# Drop the null columns where all values are null
df = df.dropna(axis='columns', how='all')
# Drop the null rows
df = df.dropna()
df.head()<jupyter_output><empty_output><jupyter_text>Select your features (columns)<jupyter_code># Set features. This will also be used as your x values.
selected_features = df.drop(columns='koi_disposition')<jupyter_output><empty_output><jupyter_text>Create a Train Test SplitUse `koi_disposition` for the y values<jupyter_code>from sklearn.model_selection import train_test_split
X = selected_features
y = df.koi_disposition

X_train, X_test, y_train, y_test = train_test_split(X,y)
X_train.head(1)
len(X_train)
len(X_test)<jupyter_output><empty_output><jupyter_text>Pre-processingScale the data using the MinMaxScaler and perform some feature selection<jupyter_code># Scale your data
pd.get_dummies(y_train)

X_test.head(1)<jupyter_output><empty_output><jupyter_text>Train the Model<jupyter_code>from sklearn import classification
model = classification()
model.fit(X_train_scaled, y_train)


print(f"Training Data Score: {model.score(X_train_scaled, y_train)}")
print(f"Testing Data Score: {model.score(X_test_scaled, y_test)}")<jupyter_output>Training Data Score: 0.8493229067327865
Testing Data Score: 0.8598398169336384<jupyter_text>Hyperparameter TuningUse `GridSearchCV` to tune the model's parameters<jupyter_code># Create the GridSearchCV model
from sklearn.model_selection import GridSearchCV
parms = {"C": [1,5,10], "penalty": ["l1", "l2"]}
grid = GridSearchCV(model, parms, verbose=3)
# Train the model with GridSearch
grid.fit(X_train_scaled, y_train)

print(grid.best_params_)
print(grid.best_score_)<jupyter_output>{'C': 10, 'penalty': 'l2'}
0.8678206798186568<jupyter_text>Save the Model<jupyter_code># save your model by updating "your_name" with your name
# and "your_model" with your model variable
# be sure to turn this in to BCS
# if joblib fails to import, try running the command to install in terminal/git-bash
import joblib
filename = 'your_name.sav'
joblib.dump(your_model, filename)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10373066424021839, 'fraction_numerical': 0.028662420382165606, 'mean_word_length': 8.12448132780083, 'pattern_counts': {'":': 2, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '91739', 'license': 'RSA-MD', 'n_tokens_mistral': 829, 'n_tokens_neox': 778, 'n_words': 191, 'path': 'Instructions/starter_code/model_2.ipynb', 'repo_name': 'grahamendean/Machine-Learning-Challenge', 'size': '2198'}