Compare commits

..

2 Commits

Author SHA1 Message Date
Johannes Merl
76a6c6c840 variation 4 2024-05-09 09:25:45 +02:00
Johannes Merl
4835d3ff51 variation 2 2024-05-09 09:25:45 +02:00
4 changed files with 21 additions and 24 deletions

View File

@@ -89,10 +89,10 @@ lE =
maxDepth = 8,
weights =
ExpressionWeights
{ lambdaSpucker = 0,
lambdaSchlucker = 10,
symbol = 100,
variable = 5,
{ lambdaSpucker = 10,
lambdaSchlucker = 1,
symbol = 20,
variable = 100,
constant = 5
}
}
@@ -151,7 +151,6 @@ data LamdaExecutionEnv = LamdaExecutionEnv
data FittnesRes = FittnesRes
{ total :: R,
fitnessTotal :: R,
costAccordingToDataset :: N,
fitnessGeoMean :: R,
fitnessMean :: R,
accuracy :: R,
@@ -190,9 +189,8 @@ evalResults ex trs = do
evalResult :: LamdaExecutionEnv -> TypeRequester -> (AccountStatus -> Int -> CreditHistory -> Purpose -> Int -> Savings -> EmploymentStatus -> Int -> StatusAndSex -> OtherDebtors -> Int -> Property -> Int -> OtherPlans -> Housing -> Int -> Job -> Int -> Bool -> Bool -> GermanClass) -> (TypeRequester, FittnesRes)
evalResult ex tr result = ( tr,
FittnesRes
{ total = (biasSmall - 1) - (fromIntegral costAccordingToDS),
{ total = score,
fitnessTotal = fitness',
costAccordingToDataset = costAccordingToDS,
fitnessMean = meanOfAccuricyPerClass resAndTarget,
fitnessGeoMean = geomeanOfDistributionAccuracy resAndTarget,
accuracy = acc,
@@ -203,8 +201,7 @@ evalResult ex tr result = ( tr,
where
res = map (\(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) -> result a b c d e f g h i j k l m n o p q r s t) (fst (dset ex))
resAndTarget = (zip (snd (dset ex)) res)
acc = (foldr (\(actual,predicted) s -> if (actual == predicted) then s + 1 else s) 0 resAndTarget) / fromIntegral (length resAndTarget)
costAccordingToDS = (foldr (\(actual,predicted) s -> if ((actual) == (predicted)) then s else (if actual == Deny then s+5 else s+1)) 0 resAndTarget)
acc = (foldr (\ts s -> if ((fst ts) == (snd ts)) then s + 1 else s) 0 resAndTarget) / fromIntegral (length resAndTarget)
biasSmall = exp ((-(fromIntegral (countTrsR tr))) / 1000) -- 0 (schlecht) bis 1 (gut)
fitness' = meanOfAccuricyPerClass resAndTarget
score = fitness' + (biasSmall - 1)

View File

@@ -56,10 +56,10 @@ lE =
maxDepth = 8,
weights =
ExpressionWeights
{ lambdaSpucker = 0,
lambdaSchlucker = 10,
symbol = 100,
variable = 5,
{ lambdaSpucker = 10,
lambdaSchlucker = 1,
symbol = 20,
variable = 100,
constant = 5
}
}
@@ -68,7 +68,7 @@ lEE :: LamdaExecutionEnv
lEE =
LamdaExecutionEnv
{ -- For now these need to define all available functions and types. Generic functions can be used.
imports = ["LambdaDatasets.IrisDefinition"],
imports = ["LambdaDatasets.IrisDataset"],
training = True,
trainingData =
( map fst (takeFraktion 0.8 irisTrainingData),
@@ -89,7 +89,7 @@ shuffledLEE = do
itD <- smpl $ shuffle irisTrainingData
return LamdaExecutionEnv
{ -- For now these need to define all available functions and types. Generic functions can be used.
imports = ["LambdaDatasets.IrisDefinition"],
imports = ["LambdaDatasets.IrisDataset"],
training = True,
trainingData =
( map fst (takeFraktion 0.8 itD),
@@ -155,7 +155,7 @@ evalResults ex trs = do
evalResult :: LamdaExecutionEnv -> TypeRequester -> (Float -> Float -> Float -> Float -> IrisClass) -> (TypeRequester, FittnesRes)
evalResult ex tr result = ( tr,
FittnesRes
{ total = acc * 100 + (biasSmall - 1),
{ total = score,
fitnessTotal = fitness',
fitnessMean = meanOfAccuricyPerClass resAndTarget,
fitnessGeoMean = geomeanOfDistributionAccuracy resAndTarget,

View File

@@ -77,10 +77,10 @@ lE =
maxDepth = 8,
weights =
ExpressionWeights
{ lambdaSpucker = 0,
lambdaSchlucker = 10,
symbol = 100,
variable = 5,
{ lambdaSpucker = 10,
lambdaSchlucker = 1,
symbol = 20,
variable = 100,
constant = 5
}
}

View File

@@ -8,9 +8,9 @@ import Pipes
import Pretty
import Protolude hiding (for)
import System.IO
-- import LambdaDatasets.IrisDataset
import LambdaDatasets.IrisDataset
-- import LambdaDatasets.NurseryDataset
import LambdaDatasets.GermanDataset
-- import LambdaDatasets.GermanDataset
import Debug.Trace as DB
import qualified Data.Map.Strict as Map
@@ -35,7 +35,7 @@ options =
( long "population-size"
<> short 'p'
<> metavar "N"
<> value 100
<> value 400
<> help "Population size"
)
@@ -59,7 +59,7 @@ main =
selectionType = Tournament 3,
termination = (steps (iterations opts)),
poulationSize = (populationSize opts),
stepSize = 90,
stepSize = 120,
elitismRatio = 5/100
}
pop' <- runEffect (for (run cfg) logCsv)