Je suis débutante et j'ai besoin de votre aide. Je veux appliquer la methode de Newton Raphson à la classification. j'ai fait ce petit algorithme mais je ne sais pa comment extraire les classes ( les partitions).
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mat= matrix (c (1,5,10,6,7,4,5,3,9,12,5,6,8,15,4,2,3,4,18,7,5,7,8,5,9,2,3,6,2,9,3,6,9,19,4), ncol=5,nrow=7)
data=cbind(1,mat)
n=dim(data)[1]
m=dim(data)[2]
beta<-seq(from=1,to=0.1,length=m)
logll <- function(x , beta=c()) 
{
  beta<-c(1,0.8,0.6,0.4,0.2,0.1)
  z<-x %*% beta
  p<-1/(1+exp(-z))
  if (p<0.5) 
    y<-0
  if (p>0.5) 
    y<-1
  logll<-sum((y*log(p)+(1-y)*log(1-p)))
}
 
for (i in 1:n)
{
  x<-matrix(data[i,],ncol=m,nrow=1)
  b = maxNR(logll, start=beta, print.level=2)
  summary(b)
 
}