This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 | |
height: 700 | |
width: 960 | |
scrolling: no | |
border: no |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The unanimous Declaration of the thirteen united States of America, When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation. | |
We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness.--That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, --That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers import Conv2D, MaxPool2D, Flatten, Dense, InputLayer, BatchNormalization, Dropout | |
# build a sequential model | |
model = Sequential() | |
model.add(InputLayer(input_shape=(224, 224, 3))) | |
# 1st conv block | |
model.add(Conv2D(25, (5, 5), activation='relu', strides=(1, 1), padding='same')) | |
model.add(MaxPool2D(pool_size=(2, 2), padding='same')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imagenette_map = { | |
"n01440764" : "tench", | |
"n02102040" : "springer", | |
"n02979186" : "casette_player", | |
"n03000684" : "chain_saw", | |
"n03028079" : "church", | |
"n03394916" : "French_horn", | |
"n03417042" : "garbage_truck", | |
"n03425413" : "gas_pump", | |
"n03445777" : "golf_ball", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from inltk.inltk import get_embedding_vectors | |
# get embedding for input words | |
vectors = get_embedding_vectors("विश्लेषिकी विद्या", "hi") | |
print(vectors) | |
# print shape of the first word | |
print("shape:", vectors[0].shape) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# keras imports for the dataset and building our neural network | |
from keras.datasets import mnist | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout, Conv2D, MaxPool2D | |
from keras.utils import np_utils | |
# Flattening the images from the 28x28 pixels to 1D 787 pixels | |
X_train = X_train.reshape(60000, 784) | |
X_test = X_test.reshape(10000, 784) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const callbacks = { | |
onEpochEnd: async (epoch, logs) => { | |
console.log("epoch: " + epoch + JSON.stringify(logs)) | |
} | |
}; | |
// Generate some synthetic data for training. | |
const xs = tf.tensor2d([[1], [2], [3], [4]], [4, 1]); | |
const ys = tf.tensor2d([[1], [3], [5], [7]], [4, 1]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.preprocessing.image import ImageDataGenerator | |
# create a new generator | |
imagegen = ImageDataGenerator() | |
# load train data | |
train = imagegen.flow_from_directory("imagenette2/train/", class_mode="categorical", shuffle=False, batch_size=128, target_size=(224, 224)) | |
# load val data | |
val = imagegen.flow_from_directory("imagenette2/val/", class_mode="categorical", shuffle=False, batch_size=128, target_size=(224, 224)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
# load training data | |
train = pd.read_csv('BERT_proj/train_E6oV3lV.csv', encoding='iso-8859-1') | |
train.shape |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def extract_lemma(doc): | |
parsed_text = {'word':[], 'lemma':[]} | |
for sent in doc.sentences: | |
for wrd in sent.words: | |
#extract text and lemma | |
parsed_text['word'].append(wrd.text) | |
parsed_text['lemma'].append(wrd.lemma) | |
#return a dataframe |
NewerOlder