-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
181 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2024 Villu Ruusmann | ||
* | ||
* This file is part of JPMML-Biogeme | ||
* | ||
* JPMML-Biogeme is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* JPMML-Biogeme is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with JPMML-Biogeme. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package biogeme.results; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import net.razorvine.pickle.objects.ClassDict; | ||
import org.jpmml.python.HasArray; | ||
import org.jpmml.python.PythonObject; | ||
|
||
public class Results extends PythonObject { | ||
|
||
public Results(String module, String name){ | ||
super(module, name); | ||
} | ||
|
||
public Map<String, Number> getBetas(){ | ||
ClassDict data = getData(); | ||
|
||
List<String> betaNames = (List)data.get("betaNames"); | ||
List<Number> betaValues = (List)((HasArray)data.get("betaValues")).getArrayContent(); | ||
|
||
Map<String, Number> result = new LinkedHashMap<>(); | ||
|
||
for(int i = 0; i < betaNames.size(); i++){ | ||
String betaName = betaNames.get(i); | ||
Number betaValue = betaValues.get(i); | ||
|
||
result.put(betaName, betaValue); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public ClassDict getData(){ | ||
return get("data", ClassDict.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2024 Villu Ruusmann | ||
* | ||
* This file is part of JPMML-Biogeme | ||
* | ||
* JPMML-Biogeme is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* JPMML-Biogeme is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with JPMML-Biogeme. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package tomlkit.items; | ||
|
||
public class Float extends Item { | ||
|
||
public Float(String module, String name){ | ||
super(module, name); | ||
} | ||
|
||
@Override | ||
public Number getValue(){ | ||
return getNumber("value"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2024 Villu Ruusmann | ||
* | ||
* This file is part of JPMML-Biogeme | ||
* | ||
* JPMML-Biogeme is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* JPMML-Biogeme is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with JPMML-Biogeme. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package tomlkit.items; | ||
|
||
public class Integer extends Item { | ||
|
||
public Integer(String module, String name){ | ||
super(module, name); | ||
} | ||
|
||
@Override | ||
public Number getValue(){ | ||
return getNumber("value"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2024 Villu Ruusmann | ||
* | ||
* This file is part of JPMML-Biogeme | ||
* | ||
* JPMML-Biogeme is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* JPMML-Biogeme is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with JPMML-Biogeme. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package tomlkit.items; | ||
|
||
import org.jpmml.python.CythonObject; | ||
|
||
abstract | ||
public class Item extends CythonObject { | ||
|
||
public Item(String module, String name){ | ||
super(module, name); | ||
} | ||
|
||
abstract | ||
public Object getValue(); | ||
|
||
@Override | ||
public void __init__(Object[] args){ | ||
super.__setstate__(INIT_ARGS, args); | ||
} | ||
|
||
public String getRaw(){ | ||
return getString("raw"); | ||
} | ||
|
||
private static final String[] INIT_ARGS = { | ||
"value", | ||
"trivia", | ||
"raw" | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.