<jupyter_start><jupyter_text>Banknote Authentication Dataset--------------------------------------------Data were extracted from images that were taken from genuine and forged banknote-like specimens. For digitization, an industrial camera usually used for print inspection was used. The final images have 400x 400 pixels. Due to the object lens and distance to the investigated object gray-scale pictures with a resolution of about 660 dpi were gained. Wavelet Transform tool were used to extract features from images.Attribute Information:1. variance of Wavelet Transformed image (continuous)2. skewness of Wavelet Transformed image (continuous)3. curtosis of Wavelet Transformed image (continuous)4. entropy of image (continuous)5. class (integer)This is a copy of the UCI Machine Learning banknote authentication dataset. https://archive.ics.uci.edu/ml/datasets/banknote+authentication<jupyter_code># Read the CSV file into a Pandas DataFrame

notes = pd.read_csv('../Resources/data_banknote_authentication.csv', header=None, names=['variance','skewness','curtosis', 'entropy', 'class'])
notes.head()
# Assign the data to X and y
# Note: Sklearn requires a two-dimensional array of values
# so we use reshape() to create this

X = notes[['variance','skewness','curtosis', 'entropy']]
y = notes['class']

print("Shape: ", X.shape, y.shape)<jupyter_output><empty_output><jupyter_text>Split our data into training and testing sets<jupyter_code>from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1)<jupyter_output><empty_output><jupyter_text>Create a logistic regression model<jupyter_code>from sklearn.linear_model import LogisticRegression
classifier = LogisticRegression()
classifier<jupyter_output><empty_output><jupyter_text>Fit (train) our model by using the training data<jupyter_code>classifier.fit(X_train, y_train)<jupyter_output><empty_output><jupyter_text>Validate the model by using the test data<jupyter_code>print(f"Training Data Score: {classifier.score(X_train, y_train)}")
print(f"Testing Data Score: {classifier.score(X_test, y_test)}")<jupyter_output><empty_output><jupyter_text>Make predictions<jupyter_code>predictions = classifier.predict(X_test)
print(f"First 10 Predictions:   {predictions[:10]}")
print(f"First 10 Actual labels: {y_test[:10].tolist()}")<jupyter_output><empty_output><jupyter_text>Create the confusion matrix<jupyter_code># Create a confusion matrix on the test data
# Use the true values from y_test and the output of the model with X_test as the input
# YOUR CODE HERE<jupyter_output><empty_output><jupyter_text>Manually calculate the accuracy of the model<jupyter_code># Use the values in the confusion matrix to calculate the accuracy of the model
# Remember: accuracy = (TP + TN) / (TP + FP + TN + FN)
# YOUR CODE HERE<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10561171139769955, 'fraction_numerical': 0.00801673056814221, 'mean_word_length': 6.493472584856397, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 1, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '582240', 'license': 'ADSL', 'n_tokens_mistral': 896, 'n_tokens_neox': 852, 'n_words': 274, 'path': '01-Lesson-Plans/19-Supervised-Machine-Learning/1/Activities/08-Stu_Confusion-Matrixes/Unsolved/Stu_Confusion_Matrix.ipynb', 'repo_name': 'anirudhmungre/sneaky-lessons', 'size': '2869'}