• Guruh: 713-21 TOSHKENT - 2023 2-amaliy ish. 6-variant
• # Mashinali oqitish kirish” fanidan tayyorlagan 2-amaliy ishi topshirdi: Madatov I. Tekshirdi: Ochilov

Bog'liq
elektr 2 atrabotka
 MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI “KIBERXAVFSIZLIK” FAKULTETI “Mashinali oqitish kirish” fanidan tayyorlagan 2-AMALIY ISHI Topshirdi: Madatov I. Tekshirdi: Ochilov M. Guruh: 713-21 TOSHKENT - 2023 2-amaliy ish. 6-variant Berilgan variantdagi masala yuzasidan o’rgatuvchi tanlama(dataset)ni shakllantiring. dataset=np.array([#yosh, ma'lumot, tajriba, investitsiyalar [30,5,2,1,1], [25,3,1,3,0], [35,10,4,6,1], [28,6,3,9,0], [40,8,2,3,1], [22,2,1,1,0], [32,7,3,1,1], [27,4,2,0,0], [29,6,2,3,1], [24,3,1,0,0] ]) . Birinchi to'rtta qiymat xususiyatlarni ifodalaydi (yosh, ma'lumot, tajriba, investitsiyalar). 2.Yaratilgan dataset ning ixtiyoriy ikkita xususiyatini olgan holda matplotlib kutubxonasidan foydalanib grafik tasvirlang. x = dataset[:,1]#malumot y = dataset[:,2]#tajriba c = dataset[:,-1]#sinf plt.figure(figsize=(6,4)) plt.scatter(x[c==0], y[c==0], s=30, alpha=1, label='1-sinf', color='r', marker='s') plt.scatter(x[c==1], y[c==1], s=30, alpha=0.8, label='2-sinf', color='b', marker='^') plt.xlabel('Ma\'lumot') plt.ylabel('Tajriba') plt.legend() plt.grid() plt.show() Datasetni malumoti va tajribasi xususiyati bo’yicha grafik chizish kodi. 1-rasm. Datasetni matplotlib kutubxonasi yordamida ikkita xususiyatininng grafigi. 3.Yaratilgan datasetni modelni o’qitish uchun 85 % va testlash uchun 15% nisbatda bo’laklarga ajrating. rasm. Datasetda model qurish. X_train=dataset[:,:-1] Y_train=dataset[:,-1] x_train,x_test,y_train,y_test= train_test_split(X_train,Y_train,test_size=0.15,random_state=42) 3-Sklearn kutubxonasidan foydalangan holda logistik_regressiya modelini quring #LogisticRegression logisticRegr = LogisticRegression() logisticRegr.fit(x_train,y_train) #for train train_pred=logisticRegr.predict(x_train) 4-Model aniqligini hisoblang(o’rgatuvchi tanalama uchun). score = logisticRegr.score(x_train,y_train) print(score) 5-Modelini test to’plamdagi aniqligini hisoblang #for test test_pred=logisticRegr.predict(x_test) score=logisticRegr.score(x_test,y_test) print(score) 6-Test to’plam uchun tartibsizlik matritsasi (confusion_matrix) ni hisoblang va tariflang #confusion matrix #for train cm=confusion_matrix(y_train,train_pred) print(cm) #for tesst cm=confusion_matrix(y_test,test_pred) print(cm) Arraydao‘qituvchi xuxusiyatlari berilsa uni qaysi sinfga tegishli ekanligini chiqarib beradi. print("Logistic Regression tested : ",logisticRegr.predict([[41,6,4,2]])[0]) Natijalar: Xulosa: Men Logistic Regressianing mohiyatini tushindim, ya’ni sigmoyid functiondan foydalanilgan holda model tuzib olish hamda aniqlikni tekshirish qanday bolib borishi . Confusion matrixda -bu tasniflash algoritmining ishlashini aniqlash uchun ishlatiladigan jadvalDownload 194.19 Kb.