Dear All, I want to run "neural network" on my dataset. ########################################################## resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1) dim(data) #20*3110 out <- neuralnet(y ~ data, hidden = 4, lifesign = "minimal", linear.output = FALSE, threshold = 0.1,na.rm = TRUE) ################################################################ but I see this Error Error in varify.variables(data, formula, startweights, learningrate.limit, : argument "data" is missing, with no default What should I do now?? Best Regards, Soheila [[alternative HTML version deleted]]
Hi Soheila,
You are using the formula argument incorrectly. The neuralnet function has
a separate argument for data aptly names 'data'. You can review the
arguments by looking at the documentation with ?neuralnet.
As I cannot reproduce your data the following is not tested but I think
should work for you.
# Join your response variable to your data set.
mydata <- cbind(data, resp)
# Run neuralnet
out <- neuralnet(resp ~ ., data=mydata, hidden = 4, lifesign =
"minimal",
linear.output = FALSE, threshold = 0.1,na.rm = TRUE)
Best,
Charles
On Tue, Mar 24, 2015 at 4:47 AM, Soheila Khodakarim <lkhodakarim at
gmail.com>
wrote:
> Dear All,
>
> I want to run "neural network" on my dataset.
> ##########################################################
> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
> dim(data)
> #20*3110
>
> out <- neuralnet(y ~ data, hidden = 4, lifesign = "minimal",
linear.output
> = FALSE, threshold = 0.1,na.rm = TRUE)
> ################################################################
> but I see this Error
> Error in varify.variables(data, formula, startweights, learningrate.limit,
> :
> argument "data" is missing, with no default
>
> What should I do now??
>
> Best Regards,
> Soheila
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
Dear Charles,
Thanks for your guide.
I run this code:
library("neuralnet")
resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
mydata <- cbind(data, resp)
out1 <- neuralnet(resp~mydata[,1:3110],data=mydata, hidden = 4, lifesign
"minimal", linear.output = FALSE, threshold = 0.1)
I saw this error
Error in neurons[[i]] %*% weights[[i]] : non-conformable arguments
:(:(:(
What should I do now??
Regards,
Soheila
On Tue, Mar 24, 2015 at 3:48 PM, Charles Determan Jr <deter088 at umn.edu>
wrote:
> Hi Soheila,
>
> You are using the formula argument incorrectly. The neuralnet function
> has a separate argument for data aptly names 'data'. You can
review the
> arguments by looking at the documentation with ?neuralnet.
>
> As I cannot reproduce your data the following is not tested but I think
> should work for you.
>
> # Join your response variable to your data set.
> mydata <- cbind(data, resp)
>
> # Run neuralnet
> out <- neuralnet(resp ~ ., data=mydata, hidden = 4, lifesign =
"minimal",
> linear.output = FALSE, threshold = 0.1,na.rm >
TRUE)
>
>
> Best,
> Charles
>
> On Tue, Mar 24, 2015 at 4:47 AM, Soheila Khodakarim <lkhodakarim at
gmail.com
> > wrote:
>
>> Dear All,
>>
>> I want to run "neural network" on my dataset.
>> ##########################################################
>> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
>> dim(data)
>> #20*3110
>>
>> out <- neuralnet(y ~ data, hidden = 4, lifesign =
"minimal", linear.output
>> = FALSE, threshold = 0.1,na.rm = TRUE)
>> ################################################################
>> but I see this Error
>> Error in varify.variables(data, formula, startweights,
learningrate.limit,
>> :
>> argument "data" is missing, with no default
>>
>> What should I do now??
>>
>> Best Regards,
>> Soheila
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
>
>
[[alternative HTML version deleted]]
I should have actually created some test code for you. Here is an example:
library(neuralnet)
data(infert)
# create your formula
fm <- as.formula(paste("case ~ ", paste(colnames(infert)[c(3,4,6)],
collapse="+")))
# call neuralnet
net.infert <- neuralnet(fm, infert,
err.fct="ce", linear.output=FALSE,
likelihood=TRUE)
You don't want to index your dataset like that, you should utilize the
formula interface. Interestingly, the '.' notation doesn't seem to
work
here. Your formula call probably will look like this:
fm <- as.formula(paste("resp ~ ", paste(colnames(data),
collapse="+")))
And you call would be
out1 <- neuralnet(fm,data=mydata, hidden = 4, lifesign = "minimal",
linear.output = FALSE, threshold = 0.1)
Regards,
Charles
On Tue, Mar 24, 2015 at 9:56 AM, Soheila Khodakarim <lkhodakarim at
gmail.com>
wrote:
> Dear Charles,
>
> Thanks for your guide.
> I run this code:
>
> library("neuralnet")
> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
> mydata <- cbind(data, resp)
> out1 <- neuralnet(resp~mydata[,1:3110],data=mydata, hidden = 4, lifesign
> "minimal", linear.output = FALSE, threshold = 0.1)
>
> I saw this error
>
> Error in neurons[[i]] %*% weights[[i]] : non-conformable arguments
>
> :(:(:(
>
> What should I do now??
>
> Regards,
> Soheila
>
>
> On Tue, Mar 24, 2015 at 3:48 PM, Charles Determan Jr <deter088 at
umn.edu>
> wrote:
>
>> Hi Soheila,
>>
>> You are using the formula argument incorrectly. The neuralnet function
>> has a separate argument for data aptly names 'data'. You can
review the
>> arguments by looking at the documentation with ?neuralnet.
>>
>> As I cannot reproduce your data the following is not tested but I think
>> should work for you.
>>
>> # Join your response variable to your data set.
>> mydata <- cbind(data, resp)
>>
>> # Run neuralnet
>> out <- neuralnet(resp ~ ., data=mydata, hidden = 4, lifesign =
"minimal",
>> linear.output = FALSE, threshold = 0.1,na.rm
>> TRUE)
>>
>>
>> Best,
>> Charles
>>
>> On Tue, Mar 24, 2015 at 4:47 AM, Soheila Khodakarim <
>> lkhodakarim at gmail.com> wrote:
>>
>>> Dear All,
>>>
>>> I want to run "neural network" on my dataset.
>>> ##########################################################
>>> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
>>> dim(data)
>>> #20*3110
>>>
>>> out <- neuralnet(y ~ data, hidden = 4, lifesign =
"minimal",
>>> linear.output
>>> = FALSE, threshold = 0.1,na.rm = TRUE)
>>> ################################################################
>>> but I see this Error
>>> Error in varify.variables(data, formula, startweights,
>>> learningrate.limit,
>>> :
>>> argument "data" is missing, with no default
>>>
>>> What should I do now??
>>>
>>> Best Regards,
>>> Soheila
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more,
see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>>
>>
>
--
Dr. Charles Determan, PhD
Integrated Biosciences
[[alternative HTML version deleted]]
Dear Charles,
I rewrote code :
library("neuralnet")
resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1))
mydata <- cbind(data24_2, resp)
dim(mydata)
> 20 3111
fm <- as.formula(paste("resp ~ ", paste(colnames(mydata)[,1:3110],
collapse="+")))> Error in colnames(mydata)[, 1:3110] : incorrect number of dimensions
:(((
AND
fm <- as.formula(paste(colnames(mydata)[,3111],
paste(colnames(mydata)[,1:3110],
collapse="+")))> Error in colnames(mydata)[, 3111] : incorrect number of dimensions
Best,
Soheila
On Wed, Mar 25, 2015 at 11:12 AM, Soheila Khodakarim <lkhodakarim at
gmail.com>
wrote:
> Hi Charles,
> Many thanks for your help. I will check and let you know.
>
> Best Wishes,
> Soheila
> On Mar 25, 2015 12:17 AM, "Charles Determan Jr" <deter088 at
umn.edu> wrote:
>
>> Soheila,
>>
>> Did my second response help you? It is polite to close say if so, that
>> way others who come across the problem no that it was solved. If not,
feel
>> free to update your question.
>>
>> Regards,
>> Charles
>>
>> On Tue, Mar 24, 2015 at 9:58 AM, Soheila Khodakarim <
>> lkhodakarim at gmail.com> wrote:
>>
>>> Dear Charles,
>>>
>>> Thanks for your guide.
>>> I run this code:
>>>
>>> library("neuralnet")
>>> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
>>> mydata <- cbind(data, resp)
>>> out1 <- neuralnet(resp~mydata[,1:3110],data=mydata, hidden = 4,
lifesign
>>> >>> "minimal", linear.output = FALSE, threshold
= 0.1)
>>>
>>> I saw this error
>>>
>>> Error in neurons[[i]] %*% weights[[i]] : non-conformable arguments
>>>
>>> :(:(:(
>>>
>>> What should I do now??
>>>
>>> Regards,
>>> Soheila
>>>
>>>
>>> On Tue, Mar 24, 2015 at 3:48 PM, Charles Determan Jr <deter088
at umn.edu>
>>> wrote:
>>>
>>> > Hi Soheila,
>>> >
>>> > You are using the formula argument incorrectly. The neuralnet
function
>>> > has a separate argument for data aptly names 'data'.
You can review
>>> the
>>> > arguments by looking at the documentation with ?neuralnet.
>>> >
>>> > As I cannot reproduce your data the following is not tested
but I think
>>> > should work for you.
>>> >
>>> > # Join your response variable to your data set.
>>> > mydata <- cbind(data, resp)
>>> >
>>> > # Run neuralnet
>>> > out <- neuralnet(resp ~ ., data=mydata, hidden = 4,
lifesign >>> "minimal",
>>> > linear.output = FALSE, threshold =
0.1,na.rm >>> > TRUE)
>>> >
>>> >
>>> > Best,
>>> > Charles
>>> >
>>> > On Tue, Mar 24, 2015 at 4:47 AM, Soheila Khodakarim <
>>> lkhodakarim at gmail.com
>>> > > wrote:
>>> >
>>> >> Dear All,
>>> >>
>>> >> I want to run "neural network" on my dataset.
>>> >> ##########################################################
>>> >> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
>>> >> dim(data)
>>> >> #20*3110
>>> >>
>>> >> out <- neuralnet(y ~ data, hidden = 4, lifesign =
"minimal",
>>> linear.output
>>> >> = FALSE, threshold = 0.1,na.rm = TRUE)
>>> >>
################################################################
>>> >> but I see this Error
>>> >> Error in varify.variables(data, formula, startweights,
>>> learningrate.limit,
>>> >> :
>>> >> argument "data" is missing, with no default
>>> >>
>>> >> What should I do now??
>>> >>
>>> >> Best Regards,
>>> >> Soheila
>>> >>
>>> >> [[alternative HTML version deleted]]
>>> >>
>>> >> ______________________________________________
>>> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and
more, see
>>> >> https://stat.ethz.ch/mailman/listinfo/r-help
>>> >> PLEASE do read the posting guide
>>> >> http://www.R-project.org/posting-guide.html
>>> >> and provide commented, minimal, self-contained,
reproducible code.
>>> >>
>>> >
>>> >
>>> >
>>> >
>>> >
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more,
see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
[[alternative HTML version deleted]]
Soheila,
Set the name of the last column and remove the comma indexing the column
names. It is a vector and therefore doesn't need a comma for indexing.
Also, after loading your dataset I realized you also have invalid column
names. The mixes between hyphens and underscores makes the as.formula call
unhappy. A simple way to fix is to just change all hyphens to underscores
with gsub.
# name 'resp'
colnames(mydata)[ncol(mydata)] <- "resp"
# change hyphens to underscores
colnames(mydata) <- gsub("-","_",colnames(mydata))
# create formula (without comma index on column names)
fm <- as.formula(paste("resp ~", paste(colnames(mydata)[1:3110],
collapse="+")))
# call neuralnet
out <- neuralnet(fm,data=mydata, hidden = 4, lifesign = "minimal",
linear.output = FALSE, threshold = 0.1)
Best regards,
Charles
On Wed, Mar 25, 2015 at 3:29 AM, Soheila Khodakarim <lkhodakarim at
gmail.com>
wrote:
> Dear Charles,
>
> I rewrote code :
> library("neuralnet")
> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1))
> mydata <- cbind(data24_2, resp)
> dim(mydata)
> > 20 3111
> fm <- as.formula(paste("resp ~ ",
paste(colnames(mydata)[,1:3110],
> collapse="+")))
> > Error in colnames(mydata)[, 1:3110] : incorrect number of dimensions
> :(((
>
> AND
>
> fm <- as.formula(paste(colnames(mydata)[,3111],
> paste(colnames(mydata)[,1:3110], collapse="+")))
> > Error in colnames(mydata)[, 3111] : incorrect number of dimensions
>
> Best,
> Soheila
>
> On Wed, Mar 25, 2015 at 11:12 AM, Soheila Khodakarim <
> lkhodakarim at gmail.com> wrote:
>
>> Hi Charles,
>> Many thanks for your help. I will check and let you know.
>>
>> Best Wishes,
>> Soheila
>> On Mar 25, 2015 12:17 AM, "Charles Determan Jr" <deter088
at umn.edu> wrote:
>>
>>> Soheila,
>>>
>>> Did my second response help you? It is polite to close say if so,
that
>>> way others who come across the problem no that it was solved. If
not, feel
>>> free to update your question.
>>>
>>> Regards,
>>> Charles
>>>
>>> On Tue, Mar 24, 2015 at 9:58 AM, Soheila Khodakarim <
>>> lkhodakarim at gmail.com> wrote:
>>>
>>>> Dear Charles,
>>>>
>>>> Thanks for your guide.
>>>> I run this code:
>>>>
>>>> library("neuralnet")
>>>> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
>>>> mydata <- cbind(data, resp)
>>>> out1 <- neuralnet(resp~mydata[,1:3110],data=mydata, hidden =
4,
>>>> lifesign >>>> "minimal", linear.output =
FALSE, threshold = 0.1)
>>>>
>>>> I saw this error
>>>>
>>>> Error in neurons[[i]] %*% weights[[i]] : non-conformable
arguments
>>>>
>>>> :(:(:(
>>>>
>>>> What should I do now??
>>>>
>>>> Regards,
>>>> Soheila
>>>>
>>>>
>>>> On Tue, Mar 24, 2015 at 3:48 PM, Charles Determan Jr
<deter088 at umn.edu>
>>>> wrote:
>>>>
>>>> > Hi Soheila,
>>>> >
>>>> > You are using the formula argument incorrectly. The
neuralnet
>>>> function
>>>> > has a separate argument for data aptly names
'data'. You can review
>>>> the
>>>> > arguments by looking at the documentation with
?neuralnet.
>>>> >
>>>> > As I cannot reproduce your data the following is not
tested but I
>>>> think
>>>> > should work for you.
>>>> >
>>>> > # Join your response variable to your data set.
>>>> > mydata <- cbind(data, resp)
>>>> >
>>>> > # Run neuralnet
>>>> > out <- neuralnet(resp ~ ., data=mydata, hidden = 4,
lifesign >>>> "minimal",
>>>> > linear.output = FALSE, threshold =
0.1,na.rm >>>> > TRUE)
>>>> >
>>>> >
>>>> > Best,
>>>> > Charles
>>>> >
>>>> > On Tue, Mar 24, 2015 at 4:47 AM, Soheila Khodakarim <
>>>> lkhodakarim at gmail.com
>>>> > > wrote:
>>>> >
>>>> >> Dear All,
>>>> >>
>>>> >> I want to run "neural network" on my
dataset.
>>>> >>
##########################################################
>>>> >> resp<-c(1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1)
>>>> >> dim(data)
>>>> >> #20*3110
>>>> >>
>>>> >> out <- neuralnet(y ~ data, hidden = 4, lifesign =
"minimal",
>>>> linear.output
>>>> >> = FALSE, threshold = 0.1,na.rm = TRUE)
>>>> >>
################################################################
>>>> >> but I see this Error
>>>> >> Error in varify.variables(data, formula, startweights,
>>>> learningrate.limit,
>>>> >> :
>>>> >> argument "data" is missing, with no
default
>>>> >>
>>>> >> What should I do now??
>>>> >>
>>>> >> Best Regards,
>>>> >> Soheila
>>>> >>
>>>> >> [[alternative HTML version deleted]]
>>>> >>
>>>> >> ______________________________________________
>>>> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE
and more, see
>>>> >> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> >> PLEASE do read the posting guide
>>>> >> http://www.R-project.org/posting-guide.html
>>>> >> and provide commented, minimal, self-contained,
reproducible code.
>>>> >>
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>>
>>>> [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and
more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible
code.
>>>>
>>>
>>>
>>>
>
[[alternative HTML version deleted]]