improvements in challenge creation

This commit is contained in:
Filip Graliński 2018-08-10 13:05:42 +02:00
parent e10f92cf9c
commit 5098225bc1
3 changed files with 32 additions and 15 deletions

View File

@ -1,5 +1,5 @@
name: geval name: geval
version: 1.2.3.0 version: 1.3.0.0
synopsis: Machine learning evaluation tools synopsis: Machine learning evaluation tools
description: Please see README.md description: Please see README.md
homepage: http://github.com/name/project homepage: http://github.com/name/project

View File

@ -14,20 +14,28 @@ import Control.Exception
import Control.Monad.Trans.Resource import Control.Monad.Trans.Resource
import Data.String.Here import Data.String.Here
createChallenge :: FilePath -> GEvalSpecification -> IO () createChallenge :: Bool -> FilePath -> GEvalSpecification -> IO ()
createChallenge expectedDirectory spec = do createChallenge withDataFiles expectedDirectory spec = do
D.createDirectoryIfMissing False expectedDirectory D.createDirectoryIfMissing False expectedDirectory
D.createDirectoryIfMissing False trainDirectory
D.createDirectoryIfMissing False devDirectory
D.createDirectoryIfMissing False testDirectory
createFile (expectedDirectory </> ".gitignore") $ gitignoreContents
createFile (expectedDirectory </> "README.md") $ readmeMDContents metric testName createFile (expectedDirectory </> "README.md") $ readmeMDContents metric testName
createFile (expectedDirectory </> configFileName) $ configContents metrics precision testName createFile (expectedDirectory </> configFileName) $ configContents metrics precision testName
D.createDirectoryIfMissing False trainDirectory if withDataFiles
then
do
createFile (trainDirectory </> "train.tsv") $ trainContents metric createFile (trainDirectory </> "train.tsv") $ trainContents metric
D.createDirectoryIfMissing False devDirectory
createFile (devDirectory </> "in.tsv") $ devInContents metric createFile (devDirectory </> "in.tsv") $ devInContents metric
createFile (devDirectory </> "expected.tsv") $ devExpectedContents metric createFile (devDirectory </> expectedFile) $ devExpectedContents metric
D.createDirectoryIfMissing False testDirectory
createFile (testDirectory </> "in.tsv") $ testInContents metric createFile (testDirectory </> "in.tsv") $ testInContents metric
createFile (testDirectory </> expectedFile) $ testExpectedContents metric createFile (testDirectory </> expectedFile) $ testExpectedContents metric
createFile (expectedDirectory </> ".gitignore") $ gitignoreContents
else
return ()
where metric = gesMainMetric spec where metric = gesMainMetric spec
metrics = gesMetrics spec metrics = gesMetrics spec
precision = gesPrecision spec precision = gesPrecision spec
@ -564,4 +572,11 @@ testExpectedContents _ = [hereLit|0.11
|] |]
gitignoreContents :: String gitignoreContents :: String
gitignoreContents = "*~\n" gitignoreContents = [hereLit|
*~
*.swp
*.bak
*.pyc
*.o
.DS_Store
|]

View File

@ -4,7 +4,9 @@ module GEval.OptionsParser
(fullOptionsParser, (fullOptionsParser,
runGEval, runGEval,
runGEvalGetOptions, runGEvalGetOptions,
getOptions) where getOptions,
metricReader
) where
import Paths_geval (version) import Paths_geval (version)
import Data.Version (showVersion) import Data.Version (showVersion)
@ -218,7 +220,7 @@ runGEval''' (Just (MostWorseningFeatures otherOut)) ordering spec = do
initChallenge :: GEvalSpecification -> IO () initChallenge :: GEvalSpecification -> IO ()
initChallenge spec = case gesExpectedDirectory spec of initChallenge spec = case gesExpectedDirectory spec of
Nothing -> showInitInstructions Nothing -> showInitInstructions
Just expectedDirectory -> createChallenge expectedDirectory spec Just expectedDirectory -> createChallenge True expectedDirectory spec
showInitInstructions = do showInitInstructions = do
putStrLn [here| putStrLn [here|