Skip to content

Instantly share code, notes, and snippets.

View Bennykillua's full-sized avatar

Bennykillua

View GitHub Profile
@Bennykillua
Bennykillua / Numpycometml.py
Last active July 2, 2022 09:04
Numpy Open Source
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)
@Bennykillua
Bennykillua / Pandascometml.py
Last active July 2, 2022 09:04
Pandas Open Source
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)
@Bennykillua
Bennykillua / Scipycometml.py
Last active July 2, 2022 09:04
SciPy Open Source
from scipy import special
#exponential Function
x = special.exp10(1)
print(x)
@Bennykillua
Bennykillua / Sklearncometml.py
Last active July 2, 2022 09:08
Sklearn Open Source
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
@Bennykillua
Bennykillua / Tensorflowcometml.py
Last active July 2, 2022 09:32
Tensorflow Open Source
import tensorflow as tf
# Create a Tensor.
hello = tf.constant("hello world")
print(hello)
@Bennykillua
Bennykillua / Kerascometml.py
Created July 2, 2022 09:34
Keras Open Source
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'),
@Bennykillua
Bennykillua / pytorchcometml.py
Created July 2, 2022 14:10
pytorch Open Source
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)
@Bennykillua
Bennykillua / Nltkcometml.py
Created July 2, 2022 14:29
Nltk Open Source
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))
@Bennykillua
Bennykillua / Danfojscometml.py
Created July 2, 2022 14:33
Danfojs Open Source
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()
@Bennykillua
Bennykillua / gist:00c1ba216b1cc1335955c4ae08aba168
Last active September 16, 2023 09:35
pip install pandasai
pip install pandasai