seekia/resources/geneticPredictionModels/geneticPredictionModels.go
2024-08-09 14:23:37 +00:00

83 lines
2.4 KiB
Go

// geneticPredictionModels contains genetic prediction neural network models for predicting genetic traits
// These are .gob encoded files of []float32 weights
// This package also contains prediction accuracy information for each model
// Prediction accuracy models describe information about how accurate the predictions made by the models are
// All of the files in this package are created by the Create Genetic Models utility.
// This utility is located in /utilities/createGeneticModels/createGeneticModels.go
package geneticPredictionModels
import _ "embed"
import "errors"
//go:embed predictionModels/EyeColorModel.gob
var predictionModel_EyeColor []byte
//go:embed predictionModels/LactoseToleranceModel.gob
var predictionModel_LactoseTolerance []byte
//go:embed predictionModels/HeightModel.gob
var predictionModel_Height []byte
//Outputs:
// -bool: Model exists
// -[]byte
func GetGeneticPredictionModelBytes(traitName string)(bool, []byte){
switch traitName{
case "Eye Color":{
return true, predictionModel_EyeColor
}
case "Lactose Tolerance":{
return true, predictionModel_LactoseTolerance
}
case "Height":{
return true, predictionModel_Height
}
}
return false, nil
}
//go:embed predictionModelAccuracies/EyeColorModelAccuracy.gob
var predictionAccuracy_EyeColor []byte
//go:embed predictionModelAccuracies/LactoseToleranceModelAccuracy.gob
var predictionAccuracy_LactoseTolerance []byte
// The files returned by this function are .gob encoded geneticPrediction.DiscreteTraitPredictionAccuracyInfoMap objects
func GetPredictionModelDiscreteTraitAccuracyInfoBytes(traitName string)([]byte, error){
switch traitName{
case "Eye Color":{
return predictionAccuracy_EyeColor, nil
}
case "Lactose Tolerance":{
return predictionAccuracy_LactoseTolerance, nil
}
}
return nil, errors.New("GetPredictionModelDiscreteTraitAccuracyInfoBytes called with unknown traitName: " + traitName)
}
//go:embed predictionModelAccuracies/HeightModelAccuracy.gob
var predictionAccuracy_Height []byte
// The files returned by this function are .gob encoded geneticPrediction.NumericTraitPredictionAccuracyInfoMap objects
func GetPredictionModelNumericTraitAccuracyInfoBytes(traitName string)([]byte, error){
switch traitName{
case "Height":{
return predictionAccuracy_Height, nil
}
}
return nil, errors.New("GetPredictionModelNumericTraitAccuracyInfoBytes called with unknown traitName: " + traitName)
}