Skip to content

Instantly share code, notes, and snippets.

View AnasBrital98's full-sized avatar
👋

Anas Brital AnasBrital98

👋
View GitHub Profile
package test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import redis.clients.jedis.Jedis;
public class Main {
import redis
import random
host = '192.168.43.94'
port = 6379
db = 0
redis_client = redis.StrictRedis(host, port, db)
# créer des Hashset pour les 20 produits
first_product = 'AAAA'
# Import the necessary libraries
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D , AveragePooling2D , Dense , Dropout , Flatten
from tensorflow.keras.datasets import mnist
from tensorflow.keras.optimizers import Adam
from sklearn.metrics import accuracy_score
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
# Create a Dataset for The Model
x , y = make_blobs(n_samples=100 , n_features=2 , centers=2 , random_state=0)
# SVM works with -1 and 1 lables this is why we convert [0,1] to [-1,1]
y = np.where(y==0 , -1 , 1)
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
from torchsummary import summary
from torch.autograd import Variable
import matplotlib.pyplot as plt
# Loading The Dataset and Creating The Data Loader to iterate Over The Data
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
# Loading The DataSet
train_data = datasets.MNIST(
root = 'data',
train = True,
import matplotlib.pyplot as plt
from keras.datasets import mnist
from keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D, Conv2DTranspose
from keras.models import Model
# Get The Data
(x_train , _) , (x_test , _ ) = mnist.load_data()
# Reshape The Data
x_train = x_train.reshape(x_train.shape[0] , x_train.shape[1] , x_train.shape[2] , 1)
import matplotlib.pyplot as plt
from keras.datasets import mnist
from keras.layers import Input, Dense
from keras.models import Model
# Loading The Data
(x_train, _), (x_test, _) = mnist.load_data()
# PreProcess The Data
def pre_process(X):
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_regression
def Generate_Points(start , end , nbr_points , coefficient , noise ):
#Creating X
x = np.arange(start , end , (end -start) / nbr_points)
#calculating Y
import numpy as np
import matplotlib.pyplot as plt
from scipy import linalg
def Generate_Points(start , end , nbr_points , coefficient , noise ):
#Creating X
x = np.arange(start , end , (end -start) / nbr_points)
#calculating Y