The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

"Neural Networks NaN Error"

mksaadmksaad Member Posts: 42 Maven
edited May 2019 in Help
Hello,

I am try to train my Neural Network on the data set at http://sites.google.com/site/motazsite/teaching/data-mining-discussion/trndataCSV.csv

But I got the error below.
Process failed: operator cannot be executed (Trying to assign invalud number to matrix: NaN)

I trained many NN without any problem. What is wrong with this dataset?


Thanks,
Motaz

Answers

  • haddockhaddock Member Posts: 849 Maven
    Greetings Motaz,

    I don't think there is much wrong with the data, as the following works for me..
    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExcelExampleSource" class="ExcelExampleSource">
            <parameter key="excel_file" value="trndataCSV.csv"/>
            <parameter key="first_row_as_names" value="true"/>
            <parameter key="create_label" value="true"/>
            <parameter key="label_column" value="15"/>
        </operator>
        <operator name="ID3Numerical" class="ID3Numerical">
            <parameter key="keep_example_set" value="true"/>
        </operator>
        <operator name="ModelApplier" class="ModelApplier">
            <list key="application_parameters">
            </list>
        </operator>
        <operator name="ClassificationPerformance" class="ClassificationPerformance">
            <parameter key="accuracy" value="true"/>
            <list key="class_weights">
            </list>
        </operator>
    </operator>

    So it has more to do with the learner not liking the data, in particular not finding a number where it wants one; so changing the learner, as above, looks like the way to go. Hope that helps.


  • mksaadmksaad Member Posts: 42 Maven
    Thanks for reply,

    It worked with me now after I changed the format from csv to xls
    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExcelExampleSource" class="ExcelExampleSource">
            <parameter key="excel_file" value="d:\Users\Motaz\Desktop\dm std\DMProject\trndataCSV.xls"/>
            <parameter key="first_row_as_names" value="true"/>
            <parameter key="create_label" value="true"/>
            <parameter key="label_column" value="15"/>
        </operator>
        <operator name="NeuralNet" class="NeuralNet" breakpoints="after">
            <parameter key="keep_example_set" value="true"/>
            <list key="hidden_layer_types">
            </list>
            <parameter key="training_cycles" value="500"/>
            <parameter key="learning_rate" value="0.3"/>
        </operator>
        <operator name="ModelApplier" class="ModelApplier">
            <list key="application_parameters">
            </list>
        </operator>
        <operator name="ClassificationPerformance" class="ClassificationPerformance">
            <parameter key="accuracy" value="true"/>
            <list key="class_weights">
            </list>
        </operator>
    </operator>
    But the Model Has no Weights !!!  ???
    image
    NeuralNet
    Layer 'Input [linear]' (14 nodes) --------------------------------- [age, workclass, fnlwgt, education, education-num, marital-status, occupation, relationship, race, sex, capital-gain, capital-loss, hours-per-week, native-country]  Layer 'Hidden-1 [sigmoid]' (8 nodes) ------------------------------------ Input Weights: Node 1 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Node 2 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Node 3 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Node 4 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Node 5 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Node 6 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Node 7 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Node 8 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN  Layer 'Output [sigmoid]' (1 node) --------------------------------- Input Weights: Node 1 NaN NaN NaN NaN NaN NaN NaN NaN 
    And the Model Has been evaluated !

    PerformanceVector:
    accuracy: 68.84%
    ConfusionMatrix:
    True: <=50K >50K
    <=50K: 411 186
    >50K: 0 0

    Thanks in advance,
    Motaz
  • TobiasMalbrechtTobiasMalbrecht Moderator, Employee-RapidMiner, Member Posts: 295 RM Product Management
    Hi,

    first of all, a neural net works on numerical inputs. If you have nominal attributes as in your data set, the internal representation will be used, which assigns numerical values to the nominal ones depending on the order in which values appear in the data set. Hence, it is in no way advisable to directly work on such nominal values when learning a neural net. Unfortunately, the old implementation [tt]NeuralNet[/tt] still allows that. Anyway, the operator [tt]NeuralNet[/tt] is deprecated. You should use the operator [tt]NeuralNetImproved[/tt] instead. This one also forces you to change the value types of the nominal attributes beforehand, as it does not work on nominal attributes.

    Kind regards,
    Tobias
  • mksaadmksaad Member Posts: 42 Maven
    Hello Tobias,

    I am using Rapid Miner 4.4
    Where can find NeuralNetImproved operator?. I have only NeuralNetSimple and NeuralNet at Learner.Supervised.Functions



    Thanks,
    Motaz
  • haddockhaddock Member Posts: 849 Maven
    Greetings Motaz,

    4.4 has the new NN in the area you mentioned, mine has the other two faded to show they are to be phased out. When I looked at the data I noticed quite a few attributes that were nominal, like country. It is difficult to see a sensible way of making them numerical. So my advice again is to look at learners that handle both numeric and nominal values, and to bin the NN approach because that is for numerics.

    Just my two cents  ;)
  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    one way of making them numerical would be to use the nominal2binomial operator and then convert these binominal values to 0s and 1s.

    Another hint is, that you should check if there are missing values in your dataset. These might confuse the neural net during adapting its nodes weights.

    Greetings,
      Sebastian
  • mksaadmksaad Member Posts: 42 Maven
    I would like to thank all of you.



    Warm Greetings,
    Motaz
Sign In or Register to comment.