<jupyter_start><jupyter_text>Keras with TensorFlow Course - Python Deep Learning and Neural Networks for Beginners Tutorialhttps://www.youtube.com/watch?v=qFJeN9V1ZsI  Data Preparation and Processing<jupyter_code>import numpy as np
from random import randint
from sklearn.utils import shuffle
from sklearn.preprocessing import MinMaxScaler
train_labels = []
train_samples = []<jupyter_output><empty_output><jupyter_text>Example data:- An experimental drug was tested on individuals aged 13 to 100 in a clinical trial- The trial had 2100 participants. Half were under 65 years old, and half were 65 years or older- Around 95% of patients 65 years or older experienced side effects- Around 95% of patients under 65 experienced no side effects<jupyter_code>for i in range(50):
    # the ~5% of younger individuals who did experience side effects
    train_samples.append(randint(13,64))
    train_labels.append(1) # "1" indicates that a side effect was experienced
    
    # the ~5% of older individuals who did not experience side effects
    train_samples.append(randint(65,100))
    train_labels.append(0) # "0" indicates that a side effect was not experienced
    

for i in range(1000):
    # the ~95% of younger individuals who did not experience side effects
    train_samples.append(randint(13,64))
    train_labels.append(0) 
    
    # the ~95% of older individuals who did experience side effects
    train_samples.append(randint(65,100))
    train_labels.append(1) 
    
# turn the lists into numpy arrays and then
# shuffle the data to remove any imposed strcucture from the (random) generation process
train_samples = np.array(train_samples)
train_labels = np.array(train_labels)
type(train_samples), type(train_labels)
train_samples, train_labels = shuffle(train_samples, train_labels)
# scale the features of ages from 13 to 100, to 0 to 1 in order to pass it to the "fit" function
scaler = MinMaxScaler(feature_range = (0, 1))

#reshape the 1D form of data since the "fit" function does not take 1D data
scaled_train_samples = scaler.fit_transform(train_samples.reshape(-1, 1))
#for i in scaled_train_samples:
    #print(i)<jupyter_output><empty_output><jupyter_text>Simple tf.keras Sequential Model<jupyter_code>!pip install tensorflow
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.models import Sequential
from temsorflow.keras.layers import Activation, Dense
from tensorflow.keras.optimizers import Adam
from tesnorflow.keras.metrics import categorical_crossentropy<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06805664830841857, 'fraction_numerical': 0.02832415420928403, 'mean_word_length': 5.279012345679012, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '269607', 'license': 'MIT', 'n_tokens_mistral': 793, 'n_tokens_neox': 731, 'n_words': 274, 'path': 'Keras_with_Mandy.ipynb', 'repo_name': 'Gettinjiggywidit/14ers-git', 'size': '2542'}