Tashkent university of information technologies named after muhammad al-khorezmi
Download 172.03 Kb.
|
- Bu sahifa navigatsiya:
- Usage examples
Usage examples:
Create a remote system: from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense # Create the model model = Sequential() # Build the system model.add(Dense(units=64, activation='relu', input_dim=100)) model.add(Dense(units=64, activation='relu')) model.add(Dense(units=10, activation='softmax')) Training the model: model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy']) # Data training model.fit(x_train, y_train, epochs=10, batch_size=32) Get the results of the analysis: # Perform analysis loss, accuracy = model.evaluate(x_test, y_test) # Output analysis results print(f'Loss: {loss}') print(f'Accuracy: {accuracy}') Prognostication of analytical data: # Make a forecast predictions = model.predict(x_test) Save and load a model: # Save the model model.save('model.h5') # Loading the model model = load_model('model.h5') TensorFlow is an open source machine learning library for numerical computation used in data flow graphs. It was released under the Apache 2.0 license and was developed by Google (in particular by the Google Brain team), written in C ++ and Python so that it can work on different platforms: Linux, Windows and Mac. A project that is very well known to most people not involved in the industry, Usage examples: Create a remote system: import tensorflow as tf # Create a remote system model = tf.keras.Sequential([ tf.keras.layers.Dense(units=64, activation='relu', input_shape=(input_size,)), tf.keras.layers.Dense(units=64, activation='relu'), tf.keras.layers.Dense(units=output_size, activation='softmax') ]) Training the model: # Model training parameters model.compile(optimizer='human',loss='categorical_crossentropy', metrics=['accuracy']) # Data training model.fit(train_data, train_labels, epochs=10, batch_size=32) Get the results of the analysis: # Perform analysis loss, accuracy = model.evaluate(test_data, test_labels) # Output analysis results print(f'Loss: {loss}') print(f'Accuracy: {accuracy}') Prognostication of analytical data: # Make a forecast predictions = model.predict(test_data) Save and load a model: # Save the model model.save('model.h5') # Loading the model loaded_model = tf.keras.models.load_model('model.h5') Logistic regression (logistic regression) - belonging to classes of objects linear, which allows to estimate the a posteriori probability method of creating a classification (classifier). Logistic regression is a method of determining the relationship between variables method, one of which is strictly dependent and the others are independent. for this logistic function (recursive logistic distribution) is used. Logistics The practical significance of regression is that it is one or more independent a powerful statistical method for predicting events involving a variable is considered. Error estimation provides information about the efficiency and correctness of the logistic regression model. The implementation of the classification means organizing the classification of objects with categorical variables using the logistic regression model. Objects can be classified by inputting test data into the model. When performing classification, it is important to train and test the variables of the logistic regression model at the correct time points and against available object-based data. Implementation in Python programming language Now we have the above concept of binomial logistic regression in Python we will make it happen. In that matlab we are multivariable flowers called "iris". we use complex, each of them consists of 50 examples 3 class, but we use the first two property columns. Every single one class refers to one type of iris flower. First, we need to import the required libraries as follows − Next, load the iris dataset as follows – We can structure the training data as follows – ExampleThese values for the x- and y-axis should result in a very bad fit for linear regression: import matplotlib.pyplot as plt from scipy import stats x = [ 89,43,36,36,95,10,66,34,38,20,26,29,48,64,6,5,36,66,72,40]y = [21,46,3,35,67,95,53,72,58,10,26,34,90,33,38,20,56,2,47,15] slope, intercept, r, p, std_err = stats.linregress(x, y) def myfunc(x): return slope * x + intercept mymodel = list(map(myfunc, x))plt.scatter(x, y)
In Python, a perceptron refers to a simplified model of an artificial neuron. It is a fundamental building block of artificial neural networks, specifically in the field of deep learning. The perceptron takes multiple inputs, applies weights to them, sums them up, and passes the result through an activation function to produce an output. A perceptron can be implemented using Python code, typically using numerical computation libraries like NumPy. It involves defining the inputs, weights, bias, and an activation function. Here's an example of a simple perceptron that performs a logical AND operation: Download 172.03 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling