<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">#Boa tarde R users, supondo o CMR de uma rede neural do pacote nnet. Gostaria de saber: dado o vetor(x1,x2) >>> previsao=c(15,3)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">qual seria o resultado para a variável y. Porém o comando:</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">#predict(rede,previsao=previsao, type = "class")</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">#resulta num vetor em que não sei qual é a resposta certa !</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><br></font></div><div><font
class="Apple-style-span" face="'times new roman', 'new york', times, serif">y=c(0 ,1 ,0 ,0 ,1 ,1 ,1 ,0 ,0 ,0)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">x1=c(12,19,14,13,14,15,16,17,17,18)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">x2=c(3,7,8,6,2,9,5,1,8,7)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">amostra<-c(sample(1:5,5),sample(6:10,5));amostra</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">dados=data.frame(yfactor=factor(y),x1,x2)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">require(nnet)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">rede<- nnet(yfactor~x1+x2, data = dados, subset = amostra, size = 2, rang = 0.1,decay =
5e-4, maxit = 200)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">matriz_confusao=table(y, predict(rede,dados, type = "class"))</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">taxa_acertos= 100*( matriz_confusao[1,1]+ matriz_confusao[2,2] ) / sum(matriz_confusao)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">cat(" A taxa de acertos é de",taxa_acertos,"%","\n")</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">previsao=c(15,3)</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">predict(rede,previsao=previsao, type = "class")</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="'times new roman', 'new
york', times, serif">#Assim, qual meu erro na previsão de y dado o vetor previsão ?</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">#Desde já, agradeço-lhes ! Felicidades !</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">#Alexandro</font></div></div></div></body></html>