Skip to content

Commit

Permalink
Merge pull request #106 from PaulTalbot-INL/raven_romapi_fix
Browse files Browse the repository at this point in the history
updated to work with new raven
  • Loading branch information
dylanjm authored Oct 20, 2021
2 parents 26b2544 + 30393b4 commit 9f63724
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 19 deletions.
Binary file modified tests/integration_tests/ARMA/Sine/arma.pk
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/integration_tests/ARMA/Sine30yr/Data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scaling,Year,filename
1,10,Data_0.csv
1,40,Data_0.csv
22 changes: 22 additions & 0 deletions tests/integration_tests/ARMA/Sine30yr/Data_0.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
,Time,Signal
0,0,0
1,0.1,0.06279052
2,0.2,0.125333234
3,0.3,0.187381315
4,0.4,0.248689887
5,0.5,0.309016994
6,0.6,0.368124553
7,0.7,0.425779292
8,0.8,0.481753674
9,0.9,0.535826795
10,1,0.587785252
11,1.1,0.63742399
12,1.2,0.684547106
13,1.3,0.728968627
14,1.4,0.770513243
15,1.5,0.809016994
16,1.6,0.844327926
17,1.7,0.87630668
18,1.8,0.904827052
19,1.9,0.929776486
20,2,0.951056516
Binary file not shown.
Binary file modified tests/integration_tests/ARMA/Sine_Hour/arma.pk
Binary file not shown.
14 changes: 8 additions & 6 deletions tests/integration_tests/ARMA/train_sine.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" ?>
<Simulation verbosity="debug">
<TestInfo>
<name>ARMA_sine</name>
Expand Down Expand Up @@ -75,15 +76,15 @@
<P>0</P>
<Q>0</Q>
<Fourier>10</Fourier>
<Segment grouping='interpolate'>
<Segment grouping="interpolate">
<macroParameter>Year</macroParameter>
<Classifier class='Models' type='PostProcessor'>classifier</Classifier>
<subspace divisions='1'>Time</subspace>
<Classifier class="Models" type="PostProcessor">classifier</Classifier>
<subspace divisions="1">Time</subspace>
</Segment>
<reseedCopies>False</reseedCopies>
<seed>42</seed>
</ROM>
<PostProcessor name="classifier" subType="DataMining">
<PostProcessor name="classifier" subType="DataMining">
<KDD labelFeature="labels" lib="SciKitLearn">
<Features>Signal</Features>
<SKLtype>cluster|KMeans</SKLtype>
Expand All @@ -93,9 +94,9 @@
</Models>

<Metrics>
<SKL name="metric">
<Metric name="metric" subType="SKL">
<metricType>regression|mean_squared_error</metricType>
</SKL>
</Metric>
</Metrics>

<OutStreams>
Expand All @@ -118,4 +119,5 @@
<constant name="scaling">1.0</constant>
</MonteCarlo>
</Samplers>

</Simulation>
124 changes: 124 additions & 0 deletions tests/integration_tests/ARMA/train_sine_30yr.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" ?>
<Simulation verbosity="debug">
<TestInfo>
<name>ARMA_sine_30yr</name>
<author>talbpaul</author>
<created>2021-10-19</created>
<description>
This trains a non-stochastic sine function for use in HERON tests.
Extends training data to 30 years, albeit same 21 data points.
</description>
<classesTested>SupervisedLearning.ARMA</classesTested>
</TestInfo>

<RunInfo>
<WorkingDir>Sine30yr</WorkingDir>
<Sequence>load, train, meta, serialize, sample</Sequence>
</RunInfo>

<Steps>
<IOStep name="load">
<Input class="Files" type="">input</Input>
<Output class="DataObjects" type="HistorySet">input</Output>
</IOStep>
<RomTrainer name="train">
<Input class="DataObjects" type="HistorySet">input</Input>
<Output class="Models" type="ROM">arma</Output>
</RomTrainer>
<IOStep name="meta">
<Input class="Models" type="ROM">arma</Input>
<Output class="DataObjects" type="DataSet">meta</Output>
<Output class="OutStreams" type="Print">romMeta</Output>
</IOStep>
<IOStep name="serialize">
<Input class="Models" type="ROM">arma</Input>
<Output class="Files" type="">pk</Output>
</IOStep>
<MultiRun name="sample">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ROM">arma</Model>
<Sampler class="Samplers" type="MonteCarlo">mc</Sampler>
<Output class="DataObjects" type="DataSet">synthetic</Output>
<Output class="OutStreams" type="Print">synthetic</Output>
</MultiRun>
</Steps>

<Files>
<Input name="input">Data.csv</Input>
<Input name="pk">arma_30yr.pk</Input>
</Files>

<DataObjects>
<PointSet name="placeholder">
<Input>scaling</Input>
<Output>OutputPlaceHolder</Output>
</PointSet>
<HistorySet name="input">
<Input>scaling, Year</Input>
<Output>Signal, Time</Output>
<options>
<pivotParameter>Time</pivotParameter>
</options>
</HistorySet>
<DataSet name="synthetic">
<Input>scaling</Input>
<Output>Signal</Output>
<Index var="Time">Signal</Index>
<Index var="Year">Signal</Index>
</DataSet>
<DataSet name="meta"/>
</DataObjects>

<Models>
<ROM name="arma" subType="ARMA">
<Target>Signal, Time</Target>
<Features>scaling</Features>
<pivotParameter>Time</pivotParameter>
<P>0</P>
<Q>0</Q>
<Fourier>10</Fourier>
<Segment grouping="interpolate">
<macroParameter>Year</macroParameter>
<Classifier class="Models" type="PostProcessor">classifier</Classifier>
<subspace divisions="1">Time</subspace>
</Segment>
<reseedCopies>False</reseedCopies>
<seed>42</seed>
</ROM>
<PostProcessor name="classifier" subType="DataMining">
<KDD labelFeature="labels" lib="SciKitLearn">
<Features>Signal</Features>
<SKLtype>cluster|KMeans</SKLtype>
<n_clusters>1</n_clusters>
</KDD>
</PostProcessor>
</Models>

<Metrics>
<Metric name="metric" subType="SKL">
<metricType>regression|mean_squared_error</metricType>
</Metric>
</Metrics>

<OutStreams>
<Print name="romMeta">
<type>csv</type>
<source>meta</source>
</Print>
<Print name="synthetic">
<type>csv</type>
<source>synthetic</source>
</Print>
</OutStreams>

<Samplers>
<MonteCarlo name="mc">
<samplerInit>
<limit>1</limit>
<initialSeed>42</initialSeed>
</samplerInit>
<constant name="scaling">1.0</constant>
</MonteCarlo>
</Samplers>

</Simulation>
14 changes: 8 additions & 6 deletions tests/integration_tests/ARMA/train_sine_hour.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" ?>
<Simulation verbosity="debug">
<TestInfo>
<name>ARMA_sine</name>
Expand Down Expand Up @@ -75,15 +76,15 @@
<pivotParameter>Hour</pivotParameter>
<P>0</P>
<Q>0</Q>
<Segment grouping='interpolate'>
<Segment grouping="interpolate">
<macroParameter>YEAR</macroParameter>
<Classifier class='Models' type='PostProcessor'>classifier</Classifier>
<subspace divisions='1'>Hour</subspace>
<Classifier class="Models" type="PostProcessor">classifier</Classifier>
<subspace divisions="1">Hour</subspace>
</Segment>
<reseedCopies>False</reseedCopies>
<seed>42</seed>
</ROM>
<PostProcessor name="classifier" subType="DataMining">
<PostProcessor name="classifier" subType="DataMining">
<KDD labelFeature="labels" lib="SciKitLearn">
<Features>Signal</Features>
<SKLtype>cluster|KMeans</SKLtype>
Expand All @@ -93,9 +94,9 @@
</Models>

<Metrics>
<SKL name="metric">
<Metric name="metric" subType="SKL">
<metricType>regression|mean_squared_error</metricType>
</SKL>
</Metric>
</Metrics>

<OutStreams>
Expand All @@ -118,4 +119,5 @@
<constant name="scaling">1.0</constant>
</MonteCarlo>
</Samplers>

</Simulation>
Binary file modified tests/integration_tests/ROM/linear_rom.pk
Binary file not shown.
3 changes: 1 addition & 2 deletions tests/integration_tests/ROM/trainer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
<ExternalModel ModuleToLoad="market" name="market" subType="">
<variables>a, b, c, d, price</variables>
</ExternalModel>
<ROM name="rom" subType="SciKitLearn">
<SKLtype>linear_model|LinearRegression</SKLtype>
<ROM name="rom" subType="LinearRegression">
<Features>a, b, c, d</Features>
<Target>price</Target>
<fit_intercept>True</fit_intercept>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_capacity,sink_capacity,mean_NPV,std_NPV,med_NPV,max_NPV,min_NPV,perc_5_NPV,perc_95_NPV,samp_NPV,var_NPV,prefix,ProbabilityWeight-source_capacity,PointProbability,ProbabilityWeight
1.0,-2.0,3894.83025031,0.0,3894.83025031,3894.83025031,3894.83025031,3894.83025031,3894.83025031,3.0,0.0,1,0.5,1.0,0.5
2.0,-2.0,7791.81176253,1.11389897155e-12,7791.81176253,7791.81176253,7791.81176253,7791.81176253,7791.81176253,3.0,1.24077091883e-24,2,0.5,1.0,0.5
source_capacity,sink_capacity,mean_NPV,std_NPV,med_NPV,max_NPV,min_NPV,perc_5_NPV,perc_95_NPV,samp_NPV,var_NPV,ProbabilityWeight-source_capacity,ProbabilityWeight,prefix,PointProbability
1.0,-2.0,3894.83025031,0.0,3894.83025031,3894.83025031,3894.83025031,3894.83025031,3894.83025031,3.0,0.0,0.5,0.5,1,1.0
2.0,-2.0,7791.81176253,1.11389897155e-12,7791.81176253,7791.81176253,7791.81176253,7791.81176253,7791.81176253,3.0,1.24077091883e-24,0.5,0.5,2,1.0
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
</Components>

<DataGenerators>
<ARMA name='flex' variable="Signal">%HERON%/tests/integration_tests/ARMA/Sine/arma_long.pk</ARMA>
<ARMA name='flex' variable="Signal">%HERON%/tests/integration_tests/ARMA/Sine30yr/arma_30yr.pk</ARMA>
<Function name="functions">functions.py</Function>
</DataGenerators>
</HERON>
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/mechanics/cashflows/tests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[./Cashflows]
type = HeronIntegration
input = heron_input.xml
# prereq = SineArma
# prereq = SineArma_30yr
[./csv]
type = OrderedCSV
output = 'Runs_o/sweep.csv'
Expand Down

0 comments on commit 9f63724

Please sign in to comment.