refactor gevalCore

This commit is contained in:
Filip Gralinski 2015-08-24 22:32:09 +02:00 committed by Filip Gralinski
parent bf4b91f8f8
commit 1e444ca3ec

View File

@ -114,9 +114,17 @@ geval gevalSpec = do
metric = gesMetric gevalSpec metric = gesMetric gevalSpec
gevalCore :: Metric -> String -> String -> IO (MetricValue) gevalCore :: Metric -> String -> String -> IO (MetricValue)
gevalCore MSE expectedFilePath outFilePath = do gevalCore RMSE expectedFilePath outFilePath = do
mse <- gevalCore MSE expectedFilePath outFilePath
return $ mse ** 0.5
gevalCore metric expectedFilePath outFilePath = do
unlessM (D.doesFileExist expectedFilePath) $ throwM $ NoExpectedFile expectedFilePath unlessM (D.doesFileExist expectedFilePath) $ throwM $ NoExpectedFile expectedFilePath
unlessM (D.doesFileExist outFilePath) $ throwM $ NoOutFile outFilePath unlessM (D.doesFileExist outFilePath) $ throwM $ NoOutFile outFilePath
gevalCore' metric expectedFilePath outFilePath
gevalCore' :: Metric -> String -> String -> IO (MetricValue)
gevalCore' MSE expectedFilePath outFilePath =
runResourceT $ runResourceT $
(getZipSource $ (,) (getZipSource $ (,)
<$> ZipSource (items expectedFilePath) <$> ZipSource (items expectedFilePath)
@ -124,9 +132,6 @@ gevalCore MSE expectedFilePath outFilePath = do
$$ (CL.map itemError $$ (CL.map itemError
=$ averageC) =$ averageC)
gevalCore RMSE expectedFilePath outFilePath = do
mse <- gevalCore MSE expectedFilePath outFilePath
return $ mse ** 0.5
averageC :: MonadResource m => Sink Double m Double averageC :: MonadResource m => Sink Double m Double
averageC = getZipSink averageC = getZipSink