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
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 { |
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 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' |
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 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 |
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 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) |
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 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 |
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 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, |
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 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) |
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 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): |
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 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 |
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 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 |
NewerOlder