Comments (7)
Thanks, already pushed the same fix :) (0.2.6)
from scoruby.
Sure, can you please provide an example PMML file?
Thanks!
from scoruby.
Amazing!
Taken from http://dmg.org/pmml/v4-3/NaiveBayes.html
<PMML xmlns="http://www.dmg.org/PMML-4_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4.3">
<Header copyright="Copyright (c) 2013, DMG.org"/>
<DataDictionary numberOfFields="6">
<DataField name="age of individual" optype="continuous" dataType="double"/>
<DataField name="gender" optype="categorical" dataType="string">
<Value value="female"/>
<Value value="male"/>
</DataField>
<DataField name="no of claims" optype="categorical" dataType="string">
<Value value="0"/>
<Value value="1"/>
<Value value="2"/>
<Value value=">2"/>
</DataField>
<DataField name="domicile" optype="categorical" dataType="string">
<Value value="suburban"/>
<Value value="urban"/>
<Value value="rural"/>
</DataField>
<DataField name="age of car" optype="continuous" dataType="double"/>
<DataField name="amount of claims" optype="categorical" dataType="integer">
<Value value="100"/>
<Value value="500"/>
<Value value="1000"/>
<Value value="5000"/>
<Value value="10000"/>
</DataField>
</DataDictionary>
<NaiveBayesModel modelName="NaiveBayes Insurance" functionName="classification" threshold="0.001">
<MiningSchema>
<MiningField name="age of individual"/>
<MiningField name="gender"/>
<MiningField name="no of claims"/>
<MiningField name="domicile"/>
<MiningField name="age of car"/>
<MiningField name="amount of claims" usageType="target"/>
</MiningSchema>
<BayesInputs>
<BayesInput fieldName="age of individual">
<TargetValueStats>
<TargetValueStat value=" 100">
<GaussianDistribution mean="32.006" variance="0.352"/>
</TargetValueStat>
<TargetValueStat value=" 500">
<GaussianDistribution mean="24.936" variance="0.516"/>
</TargetValueStat>
<TargetValueStat value=" 1000">
<GaussianDistribution mean="24.588" variance="0.635"/>
</TargetValueStat>
<TargetValueStat value=" 5000">
<GaussianDistribution mean="24.428" variance="0.379"/>
</TargetValueStat>
<TargetValueStat value="10000">
<GaussianDistribution mean="24.770" variance="0.314"/>
</TargetValueStat>
</TargetValueStats>
</BayesInput>
<BayesInput fieldName="gender">
<PairCounts value="male">
<TargetValueCounts>
<TargetValueCount value="100" count="4273"/>
<TargetValueCount value="500" count="1321"/>
<TargetValueCount value="1000" count="780"/>
<TargetValueCount value="5000" count="405"/>
<TargetValueCount value="10000" count="42"/>
</TargetValueCounts>
</PairCounts>
<PairCounts value="female">
<TargetValueCounts>
<TargetValueCount value="100" count="4325"/>
<TargetValueCount value="500" count="1212"/>
<TargetValueCount value="1000" count="742"/>
<TargetValueCount value="5000" count="292"/>
<TargetValueCount value="10000" count="48"/>
</TargetValueCounts>
</PairCounts>
</BayesInput>
<BayesInput fieldName="no of claims">
<PairCounts value="0">
<TargetValueCounts>
<TargetValueCount value="100" count="4698"/>
<TargetValueCount value="500" count="623"/>
<TargetValueCount value="1000" count="1259"/>
<TargetValueCount value="5000" count="550"/>
<TargetValueCount value="10000" count="40"/>
</TargetValueCounts>
</PairCounts>
<PairCounts value="1">
<TargetValueCounts>
<TargetValueCount value="100" count="3526"/>
<TargetValueCount value="500" count="1798"/>
<TargetValueCount value="1000" count="227"/>
<TargetValueCount value="5000" count="152"/>
<TargetValueCount value="10000" count="40"/>
</TargetValueCounts>
</PairCounts>
<PairCounts value="2">
<TargetValueCounts>
<TargetValueCount value="100" count="225"/>
<TargetValueCount value="500" count="10"/>
<TargetValueCount value="1000" count="9"/>
<TargetValueCount value="5000" count="0"/>
<TargetValueCount value="10000" count="10"/>
</TargetValueCounts>
</PairCounts>
<PairCounts value=">2">
<TargetValueCounts>
<TargetValueCount value="100" count="112"/>
<TargetValueCount value="500" count="5"/>
<TargetValueCount value="1000" count="1"/>
<TargetValueCount value="5000" count="1"/>
<TargetValueCount value="10000" count="8"/>
</TargetValueCounts>
</PairCounts>
</BayesInput>
<BayesInput fieldName="domicile">
<PairCounts value="suburban">
<TargetValueCounts>
<TargetValueCount value="100" count="2536"/>
<TargetValueCount value="500" count="165"/>
<TargetValueCount value="1000" count="516"/>
<TargetValueCount value="5000" count="290"/>
<TargetValueCount value="10000" count="42"/>
</TargetValueCounts>
</PairCounts>
<PairCounts value="urban">
<TargetValueCounts>
<TargetValueCount value="100" count="1679"/>
<TargetValueCount value="500" count="792"/>
<TargetValueCount value="1000" count="511"/>
<TargetValueCount value="5000" count="259"/>
<TargetValueCount value="10000" count="30"/>
</TargetValueCounts>
</PairCounts>
<PairCounts value="rural">
<TargetValueCounts>
<TargetValueCount value="100" count="2512"/>
<TargetValueCount value="500" count="1013"/>
<TargetValueCount value="1000" count="442"/>
<TargetValueCount value="5000" count="137"/>
<TargetValueCount value="10000" count="21"/>
</TargetValueCounts>
</PairCounts>
</BayesInput>
<BayesInput fieldName="age of car">
<DerivedField optype="categorical" dataType="string">
<Discretize field="age of car">
<DiscretizeBin binValue="0">
<Interval closure="closedOpen" leftMargin="0" rightMargin="1"/>
</DiscretizeBin>
<DiscretizeBin binValue="1">
<Interval closure="closedOpen" leftMargin="1" rightMargin="5"/>
</DiscretizeBin>
<DiscretizeBin binValue="2">
<Interval closure="closedOpen" leftMargin="5"/>
</DiscretizeBin>
</Discretize>
</DerivedField>
<PairCounts value="0">
<TargetValueCounts>
<TargetValueCount value="100" count="927"/>
<TargetValueCount value="500" count="183"/>
<TargetValueCount value="1000" count="221"/>
<TargetValueCount value="5000" count="50"/>
<TargetValueCount value="10000" count="10"/>
</TargetValueCounts>
</PairCounts>
<PairCounts value="1">
<TargetValueCounts>
<TargetValueCount value="100" count="830"/>
<TargetValueCount value="500" count="182"/>
<TargetValueCount value="1000" count="51"/>
<TargetValueCount value="5000" count="26"/>
<TargetValueCount value="10000" count="6"/>
</TargetValueCounts>
</PairCounts>
<PairCounts value="2">
<TargetValueCounts>
<TargetValueCount value="100" count="6251"/>
<TargetValueCount value="500" count="1901"/>
<TargetValueCount value="1000" count="919"/>
<TargetValueCount value="5000" count="623"/>
<TargetValueCount value="10000" count="71"/>
</TargetValueCounts>
</PairCounts>
</BayesInput>
</BayesInputs>
<BayesOutput fieldName="amount of claims">
<TargetValueCounts>
<TargetValueCount value="100" count="8723"/>
<TargetValueCount value="500" count="2557"/>
<TargetValueCount value="1000" count="1530"/>
<TargetValueCount value="5000" count="709"/>
<TargetValueCount value="10000" count="100"/>
</TargetValueCounts>
</BayesOutput>
</NaiveBayesModel>
</PMML>
from scoruby.
Hey
Deployed a very initial version (0.2.5), still needs refactoring (extract data class) and probably has some bugs.
You can use spec for reference, wasn't sure if my output was right so just printed it until I finalize it.
Please let me now if anything doesn't work, I'll be happy to fix
Thanks :)
from scoruby.
Thank you very much.
Currently I'm getting RuntimeError: model not supported
from scoruby.
I added a PR to solve it. Looking into the data.
from scoruby.
Added specs by http://dmg.org/pmml/v4-3/NaiveBayes.html
from scoruby.
Related Issues (8)
- RubyML list HOT 3
- Small wiki update HOT 2
- Support for GBM regression HOT 5
- Decision Trees HOT 14
- Namespace the files under lib directory HOT 3
- Support for CART (binary splits) vs CHAID HOT 3
- Support for sklearn2pmml generated PMML HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scoruby.