1-mustaqil ish bajardi: Sulxonqulov Suxrobjon


Download 49.34 Kb.
Sana17.06.2023
Hajmi49.34 Kb.
#1536643
Bog'liq
Suxrob



Muhammad al-Xorazmiy nomidagi
Toshkent axborot texnologiyalari universiteti
KIF” fakulteti talabasining
Pedagogika. Psixologiyasi”
Fanidan topshirgan

1-MUSTAQIL ISH

Bajardi: Sulxonqulov Suxrobjon


Tekshirdi: Nurmurodov Javohir

Savollar:

1. Chiziqli regressiya yordamida baholash jarayonini bashoratlash y=wx.
2. Sigmoid aktivlash funksiyasi yordamida sinflashtirish.
3. Matritsani matritsaga ko’paytirish dasturi.
4. Softmax aktivlash funksiyasi yordamida sinflashtirish.


  1. Chiziqli regressiya yordamida baholash jarayonini bashoratlash y=wx.

import numpy as np
import matplotlib.pyplot as plt
import math
n = int (input('Kerakli son= '))
m = int(input('Testlar qiymati = '))
x = [1,2,3]
y = [2,4,6]
w = np.zeros(n)
r = np.zeros(n)
w[0]=4
a = 0.01
for i in range(1,n):
for j in range(0,3):
w[i]=w[i-1]-a*2*(w[i-1]*x[j]-y[j])*x[j]
r[i-1]=(w[i-1]*x[j]-y[j])**2
if 0.001z= w[i-1]*m
print(z)

2.
Sigmoid aktivlash funksiyasi yordamida sinflashtirish.

import numpy as np


def sig(x):
return 1/(1 + np.exp(-x))
import numpy as np
def sig(x):
return 1/(1 + np.exp(-x))
x = 1.0
print('Applying Sigmoid Activation on (%.1f) gives %.1f' % (x, sig(x)))

x = -10.0


print('Applying Sigmoid Activation on (%.1f) gives %.1f' % (x, sig(x)))

x = 0.0
print('Applying Sigmoid Activation on (%.1f) gives %.1f' % (x, sig(x)))


x = 15.0
print('Applying Sigmoid Activation on (%.1f) gives %.1f' % (x, sig(x)))


x = -2.0
print('Applying Sigmoid Activation on (%.1f) gives %.1f' % (x, sig(x)))


Applying Sigmoid Activation on (1.0) gives 0.7


Applying Sigmoid Activation on (-10.0) gives 0.0
Applying Sigmoid Activation on (0.0) gives 0.5
Apply

3.
Matritsani matritsaga ko’paytirish dasturi.
#include
using namespace std;
int main()
{
int m1[10][10], m2[10][10], mul[10][10];
int r1, c1, r2, c2, i, j, k;
cout << "Birinchi matritsaning satrlari va ustunlari sonini kiriting: ";
cin >> r1 >> c1;
cout << "Birinchi matritsaning elementlarini kiriting: " << endl;
for(i = 0; i < r1; ++i)
for(j = 0; j < c1; ++j)
cin >> m1[i][j];
cout << "Ikkinchi matritsaning satr va ustunlari sonini kiriting: ";
cin >> r2 >> c2;
if (c1 != r2)
{
cout << "Matritsalarni ko'paytirib bo'lmaydi!";
return 0;
}

cout << "Ikkinchi matritsaning elementlarini kiriting: " << endl;


for(i = 0; i < r2; ++i)
for(j = 0; j < c2; ++j)
cin >> m2[i][j];
for(i = 0; i < r1; ++i)
for(j = 0; j < c2; ++j)
{
mul[i][j] = 0;
for(k = 0; k < c1; ++k)
mul[i][j] += m1[i][k] * m2[k][j];
}
cout << "Matritsaning natijasi: " << endl;
for(i = 0; i < r1; ++i)
for(j = 0; j < c2; ++j)
{
cout << mul[i][j] << " ";
if(j == c2-1)
cout << endl;
}
return 0;
}


4.
Softmax aktivlash funksiyasi yordamida sinflashtirish.

import numpy as np


import seaborn as sns

def sigmoid(x):


exp_x = np.exp(x)
return np.divide(exp_x,(1 + exp_x))
x = np.linspace(-10,10,num=200)
exp_x = np.exp(x)
sigmoid_arr = sigmoid(x)

sns.set_theme()


sns.lineplot(x = x,y = sigmoid_arr).set(title='Sigmoid Function')

Download 49.34 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling