Skip to content

Instantly share code, notes, and snippets.

View Gongsta's full-sized avatar
🎯
Focusing

Steven Gong Gongsta

🎯
Focusing
View GitHub Profile
C++ 8 hrs 30 mins █████▉░░░░░░░░░░░░░░░ 28.4%
Markdown 7 hrs 48 mins █████▍░░░░░░░░░░░░░░░ 26.1%
TypeScript 3 hrs 5 mins ██▏░░░░░░░░░░░░░░░░░░ 10.3%
Java 2 hrs 56 mins ██░░░░░░░░░░░░░░░░░░░ 9.8%
C 2 hrs 20 mins █▋░░░░░░░░░░░░░░░░░░░ 7.8%
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
sentences = [
'I love eating at McDonalds',
'I love the food here'
]
/* Ultrasonic distance sensor HC-SR04 demo sketch
*
* This sketch calculates the distance between the HC-SR04 sensor and
* an object directly infront of it.
*
*
*
* Components
* ----------
* - Arduino Uno
import dask
import dask.dataframe as dd
df = dask.datasets.timeseries()
#Unlike Pandas, Dask DataFrames are lazy and so no data is printed here.
df
df.dtypes
from dask.distributed import Client
client = Client()
client
import dask.array as da
x = da.random.random((10000, 10000), chunks=(1000, 1000))
x
y = x + x.T
z = y[::2, 5000:].mean(axis=1)
z
z.compute()
# Importing the Keras libraries and packages
import keras
from keras.models import Sequential #used to initialize the NN
from keras.layers import Dense #used to build the hidden Layers
from keras.layers import Dropout
# Initialising the ANN
classifier = Sequential()
# Adding the input layer and the first hidden layer with dropout
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('/Users/stevengong/Desktop/Deep-Learning-course/Volume 1 - Supervised Deep Learning/Part 1 - Artificial Neural Networks (ANN)/Section 4 - Building an ANN/Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.iloc[:, 13].values
# Encoding categorical data
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
from sklearn.compose import ColumnTransformer
# Predicting the Test set results
y_pred = classifier.predict(X_test)
y_pred = (y_pred > 0.5)
# Making the Confusion Matrix
from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_test, y_pred)
# Fitting the ANN to the Training set
classifier.fit(X_train, y_train, batch_size = 10, epochs = 100)