Qo'lni kuzatish bu kompyuterning kirish tasviridan qo'lni aniqlash va qo'l harakati va yo'nalishiga e'tibor berish uchun kompyuter ko'rish qobiliyatidan foydalanadigan jarayon


Download 69.57 Kb.
bet4/4
Sana20.11.2023
Hajmi69.57 Kb.
#1789150
1   2   3   4
Bog'liq
Machine learning-2-amaliy

Logistik regressiya C++
#include
#include
#include
#include
#include
using namespace std;
int main() {
double x[100],y[100],y1[100],loss[100];
srand(time(0));
ofstream Logistik;
Logistik.open("Logistik_reg.csv");
for(int i=0;i<100;i++){
x[i]=rand()%10;
y[i]=rand()%10;
cout<<"\n x["< cout<<" y["< y1[i]=1/(1+exp(-y[i]));
cout<<" y1["< if(y[i]<=x[i]) {
cout<<" -> True "<<1;
}
else {
cout<<" -> False "<<0;
}
loss[i]=fabs((1-y[i])*log(1-y1[i])+y[i]*log(y1[i]));
} Logistik<<" Y1 "< for(int i=0;i<100;i++){
if(y1[i]<=0.5) y1[i]=0;
else y1[i]=1;
Logistik< } Logistik<<" Loss "< for(int i=0;i<100;i++){
Logistik< }

return 0;
}

Download 69.57 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




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