This file contains 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 numpy as np | |
#creating an array wiith np.array | |
new_matrix = np.array([[1,2,3], [4,5,6], [7,8,9]]) | |
print(new_matrix) |
This file contains 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 | |
df = pd.DataFrame({"A":[1, 10, 100, 1000, 10000], | |
"B":[2, 20, 200, 2000, 20000], | |
"C":[3, 30, 300, 3000, 30000], | |
"D":[4, 40, 400, 4000, 40000]}) | |
#return the mean absolute deviation of the values for the requested axis | |
df.mad(axis = 0) |
This file contains 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 scipy import special | |
#exponential Function | |
x = special.exp10(1) | |
print(x) |
This file contains 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 sklearn import cluster, datasets | |
# load data | |
iris = datasets.load_iris() | |
# K-means clustering: create clusters for k=3 | |
k=3 | |
k_means = cluster.KMeans(k) | |
# fit data |
This file contains 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 tensorflow as tf | |
# Create a Tensor. | |
hello = tf.constant("hello world") | |
print(hello) |
This file contains 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 tensorflow as tf | |
from tensorflow import keras | |
#load dataset | |
mnist = tf.keras.datasets.mnist | |
#Build a machine learning model | |
model = tf.keras.models.Sequential([ | |
tf.keras.layers.Flatten(input_shape=(28, 28)), | |
tf.keras.layers.Dense(100, activation='relu'), |
This file contains 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 torch | |
p_Tensor = torch.ones((2, 2)) | |
#size of a Tensor | |
print(p_Tensor.size()) | |
#resizing 2x2 Tensor to 4x1 | |
p_Tensor = p_Tensor.view(4) |
This file contains 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 nltk.stem import PorterStemmer | |
#from nltk.tokenize import sent_tokenize, word_tokenize | |
ps = PorterStemmer() | |
text_words = ["tech","technology","technologized","techy", "Technologization"] | |
for x in text_words: | |
print(ps.stem(x)) |
This file contains 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
npm install danfojs-node | |
import * as dfd from "danfojs-node" | |
#creating a DataFrame/Series | |
s = new dfd.Series([1, 3, 5, undefined, 6, 8]) | |
s.print() |
This file contains 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
pip install pandasai |
OlderNewer