dataframe 0.4.0.9 → 0.4.0.10
raw patch · 3 files changed
+9/−54 lines, 3 filesdep −ollama-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: ollama-haskell
API changes (from Hackage documentation)
- DataFrame.DecisionTree: instructions :: String
- DataFrame.DecisionTree: score :: Expr a -> Int
Files
- CHANGELOG.md +6/−0
- dataframe.cabal +2/−3
- src/DataFrame/DecisionTree.hs +1/−51
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Revision history for dataframe +## 0.4.0.10+* License in cabal was wrong.+* Remove ollama-haskell dependencies.+* readParquetFiles for reading globs.+* Fixed printing of `neq` function. + ## 0.4.0.9 * Update license to MIT.
dataframe.cabal view
@@ -1,13 +1,13 @@ cabal-version: 2.4 name: dataframe-version: 0.4.0.9+version: 0.4.0.10 synopsis: A fast, safe, and intuitive DataFrame library. description: A fast, safe, and intuitive DataFrame library for exploratory data analysis. bug-reports: https://github.com/mchav/dataframe/issues-license: GPL-3.0-or-later+license: MIT license-file: LICENSE author: Michael Chavinda maintainer: mschavinda@gmail.com@@ -102,7 +102,6 @@ directory >= 1.3.0.0 && < 2, granite == 0.3.0.5, hashable >= 1.2 && < 2,- ollama-haskell >= 0.1 && < 1, process ^>= 1.6, snappy-hs ^>= 0.1, random >= 1.3 && < 2,
src/DataFrame/DecisionTree.hs view
@@ -29,7 +29,6 @@ import Data.List (foldl', maximumBy, sort, sortBy) import qualified Data.Map.Strict as M import Data.Maybe-import Data.Ollama.Generate import qualified Data.Text as T import Data.Type.Equality import qualified Data.Vector as V@@ -185,54 +184,6 @@ SFalse -> [] _ -> [] -instructions :: String-instructions =- "You must output ONLY a single digit 0-10, nothing else. No explanation, no text, just the number. \n"- ++ "Rate whether this expression produces a meaningful real-world quantity: \n"- ++ "Evaluate if this expression produces a meaningful quantity by checking:\n"- ++ "- Do the units/types match for the operation?\n"- ++ "- Is either operand a categorical code rather than a true quantity?\n"- ++ "- Would the result be useful to actually calculate?\n"- ++ "Scoring: \n"- ++ " - 0-3: Result is meaningless (e.g., \"fare + age\" = dollars+years, \"height + weight\" = meters+kg)\n"- ++ " - 4-5: Unclear or context-dependent meaning\n"- ++ " - 6-7: Makes sense in specific domains\n"- ++ " - 8-9: Clear, commonly useful quantity\n"- ++ " - 10: Fundamental/universal quantity\n"- ++ "Guidelines:\n"- ++ "- Addition/subtraction: operands must represent the same kind of thing\n"- ++ "- Multiplication/division: can create meaningful derived quantities\n"- ++ "- Consider: would this result be useful to calculate in practice?\n"- ++ "- `toDouble` is just a function that converts any number to a decimal and is semantically unimportant.\n"- ++ "Examples:\n"- ++ "toDouble(fare) + toDouble(age) = 2 (adding money to years)\n"- ++ "toDouble(price) / toDouble(area) = 9 (price per sq ft)\n"- ++ "toDouble(distance) / toDouble(time) = 10 (speed)\n"- ++ "toDouble(num_people) * toDouble(rejection_rate) = 9 (expected rejections)\n"- ++ "toDouble(revenue) - toDouble(costs) = 10 (profit)\n"- ++ "toDouble(height) + toDouble(weight) = 2 (adding length to mass)\n"- ++ "Output format: Just the digit, e.g., 2\n"- ++ "Think very carefully about each but only give me the final answer.\n"- ++ "Expression: "--score :: Expr a -> Int-score expr =- let- genOp =- defaultGenerateOps- { modelName = "llama3"- , prompt = T.pack (instructions ++ prettyPrint expr)- }- llamaConfig = Just (defaultOllamaConfig{hostUrl = "http://127.0.0.1:8080"})- result = unsafePerformIO $ try @SomeException (generate genOp llamaConfig)- in- case result of- Right (Right response) ->- let llmResponse = genResponse response- s = fst $ either error id $ decimal @Int llmResponse- in trace (prettyPrint expr ++ ": " ++ show s) s- _ -> 7- numericExprs :: SynthConfig -> DataFrame -> [Expr Double] -> Int -> Int -> [Expr Double] numericExprs cfg df prevExprs depth maxDepth@@ -256,8 +207,7 @@ (disallowedCombinations cfg) ) )- concat [[e1 + e2, e1 - e2] | score (e1 + e2) > 5]- ++ concat [[e1 * e2, F.ifThenElse (e2 ./= 0) (e1 / e2) 0] | score (e1 * e2) > 5]+ [e1 + e2, e1 - e2, e1 * e2, F.ifThenElse (e2 ./= 0) (e1 / e2) 0] boolExprs :: DataFrame -> [Expr Bool] -> [Expr Bool] -> Int -> Int -> [Expr Bool]