Code Monkey home page Code Monkey logo

Comments (7)

vruusmann avatar vruusmann commented on May 15, 2024

The exception is also sent to openscoring log file. What does it say?

I have a reason to think that your PMML file is invalid. More specifically, there's something wrong with the DataDictionary element (does not contain any DataField child elements?). Could you share your PMML file?

Every activeField object should provide id, dataType and opType mappings:

"activeFields" : [
  {
    "id" : "hsa-miR-16-2-3p",
    "dataType" : "double"
    "opType" : "continuous"
  }
]

For some reason, there is no dataType mapping in your model response.

from openscoring.

kstawiski avatar kstawiski commented on May 15, 2024

Thank you for your quick response. Here it is (I had to change extenstion to txt):
NeuralNetwork.txt

from openscoring.

kstawiski avatar kstawiski commented on May 15, 2024

I have reminded myself of my previous issue with STATISTICA (#4) and added dataType="" in all DataFields. Now I have new message:

{
"message" : "NeuralLayer"
}

from openscoring.

vruusmann avatar vruusmann commented on May 15, 2024

There's no point in adding empty dataType="" to all DataField elements.

You should add dataType="double" to continuous fields, and dataType="string" to categorical fields.

from openscoring.

vruusmann avatar vruusmann commented on May 15, 2024

I tried evaluating your NN model with the example data record. The exception message "NeuralLayer" is another InvalidFeatureException, which is raised because the second NeuralLayer doesn't specify the activationFunction attribute.

Am I correct to assume that both neural layers use tanh activation function?

<NeuralLayer numberOfNeurons="2" activationFunction="tanh" normalizationMethod="softmax">

Anyway, after defining this attribute, the example data record evaluates to the following result:

{
  "id" : "Uw4Fz",
  "result" : {
    "2 group" : "Controls+Borderline"
  }
}

from openscoring.

vruusmann avatar vruusmann commented on May 15, 2024

What should we do about STATISTICA neural network models then? Every time you train a new model, you must to do the following:

  1. Add missing DataField@dataType attributes.
  2. Add missing NeuralLayer@activationFunction attributes.

This correction work could be automated by developing a special-purpose JPMML-Model Visitor class:

public class StatisticaCorrector extends AbstractVisitor {

  @Override
  public VisitorAction visit(DataField dataField){
    if(dataField.getDataType() == null){
      OpType opType = dataField.getOpType();
      switch(opType){
        case CONTINUOUS:
          dataField.setDataType(DataType.DOUBLE);
          break;
        case CATEGORICAL:
          dataField.setDataType(DataType.STRING);
          break;
      }  
    }
    return super.visit(dataField);
  }

  @Override
  public VisitorAction visit(NeuralLayer neuralLayer){
    if(neuralLayer.getActivationFunction() == null){
      neuralLayer.setActivationFunction(ActivationFunctionType.TANH);
    }
    return super.visit(neuralLayer);
  }
}

If you register this JPMML-Model Visitor class in Openscoring configuration file, then all the uploaded STATISTICA neural network models would be corrected automatically.

from openscoring.

kstawiski avatar kstawiski commented on May 15, 2024

Thank you. All is working now.

from openscoring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.