more downsample progress, only a few more functions to go :), need to test this
This commit is contained in:
parent
fc2aaff280
commit
d51a20f66f
@ -3,6 +3,7 @@ module HushGP.GP.Downsample where
|
||||
import System.Random.Shuffle
|
||||
import System.Random
|
||||
import Data.List
|
||||
import Data.Maybe
|
||||
import HushGP.Genome
|
||||
import HushGP.Utility
|
||||
import HushGP.GP.PushData
|
||||
@ -112,9 +113,16 @@ updateAtIndices' bigList _ [] = bigList
|
||||
updateAtIndices' bigList [] _ = bigList
|
||||
updateAtIndices' bigList (sval:svals) (idx:idxs) = updateAtIndices' (replaceAt idx sval bigList) svals idxs
|
||||
|
||||
-- |Merges two lists of [Pushdata], replacing the PushData in the lists with their corresponding
|
||||
-- (based on index) PushData in the small list.
|
||||
mergePushDataListsAtIndex :: [PushData] -> [PushData] -> [PushData]
|
||||
mergePushDataListsAtIndex bigList smallList = map (\x -> let correspondingSmall = find (\y -> extractIndex x == extractIndex y) smallList in fromMaybe x correspondingSmall) bigList
|
||||
|
||||
-- |Updates the cases distances when downsampling.
|
||||
updateCaseDistances :: [Individual] -> [PushData] -> [PushData] -> String -> Double -> [PushData]
|
||||
updateCaseDistances evaledPop downsampleData trainingData informedDownsamplingType solutionThreshold = undefined
|
||||
|
||||
|
||||
-- map (\other -> getDistanceBetweenCases [[0,0],[0,0]] 0 other) [0..(length [3,4] - 1)]
|
||||
-- tempData = intTrainData !! 0
|
||||
-- dCase = tempData{_downsampleIndex = Just 3, _caseDistances = Just [2,2,2,2,2]}
|
||||
|
@ -31,6 +31,7 @@ testIntDsData = [
|
||||
(intTrainData !! 1){_downsampleIndex = Just 4, _caseDistances = Just [2,2,2,2,2]}
|
||||
]
|
||||
|
||||
-- This is the map-indexed call in the update-case-distances function.
|
||||
tempFunc :: [PushData]
|
||||
tempFunc = mapIndexed (\idx dCase -> dCase{_caseDistances = Just (updateAtIndices (extractDistance dCase) (map (\other -> getDistanceBetweenCases [[0,0],[0,0]] idx other) [0..(length [3,4] - 1)]) [3,4])}) testIntDsData
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user