Skip to content

Commit 43a91a8

Browse files
committed
feat: Remove llm code.
1 parent b82e237 commit 43a91a8

2 files changed

Lines changed: 2 additions & 53 deletions

File tree

dataframe.cabal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ synopsis: A fast, safe, and intuitive DataFrame library.
77
description: A fast, safe, and intuitive DataFrame library for exploratory data analysis.
88

99
bug-reports: https://github.com/mchav/dataframe/issues
10-
license: GPL-3.0-or-later
10+
license: MIT
1111
license-file: LICENSE
1212
author: Michael Chavinda
1313
maintainer: mschavinda@gmail.com
@@ -102,7 +102,6 @@ library
102102
directory >= 1.3.0.0 && < 2,
103103
granite == 0.3.0.5,
104104
hashable >= 1.2 && < 2,
105-
ollama-haskell >= 0.1 && < 1,
106105
process ^>= 1.6,
107106
snappy-hs ^>= 0.1,
108107
random >= 1.3 && < 2,

src/DataFrame/DecisionTree.hs

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import Data.Function (on)
2929
import Data.List (foldl', maximumBy, sort, sortBy)
3030
import qualified Data.Map.Strict as M
3131
import Data.Maybe
32-
import Data.Ollama.Generate
3332
import qualified Data.Text as T
3433
import Data.Type.Equality
3534
import qualified Data.Vector as V
@@ -185,54 +184,6 @@ numericCols df = concatMap extract (columnNames df)
185184
SFalse -> []
186185
_ -> []
187186

188-
instructions :: String
189-
instructions =
190-
"You must output ONLY a single digit 0-10, nothing else. No explanation, no text, just the number. \n"
191-
++ "Rate whether this expression produces a meaningful real-world quantity: \n"
192-
++ "Evaluate if this expression produces a meaningful quantity by checking:\n"
193-
++ "- Do the units/types match for the operation?\n"
194-
++ "- Is either operand a categorical code rather than a true quantity?\n"
195-
++ "- Would the result be useful to actually calculate?\n"
196-
++ "Scoring: \n"
197-
++ " - 0-3: Result is meaningless (e.g., \"fare + age\" = dollars+years, \"height + weight\" = meters+kg)\n"
198-
++ " - 4-5: Unclear or context-dependent meaning\n"
199-
++ " - 6-7: Makes sense in specific domains\n"
200-
++ " - 8-9: Clear, commonly useful quantity\n"
201-
++ " - 10: Fundamental/universal quantity\n"
202-
++ "Guidelines:\n"
203-
++ "- Addition/subtraction: operands must represent the same kind of thing\n"
204-
++ "- Multiplication/division: can create meaningful derived quantities\n"
205-
++ "- Consider: would this result be useful to calculate in practice?\n"
206-
++ "- `toDouble` is just a function that converts any number to a decimal and is semantically unimportant.\n"
207-
++ "Examples:\n"
208-
++ "toDouble(fare) + toDouble(age) = 2 (adding money to years)\n"
209-
++ "toDouble(price) / toDouble(area) = 9 (price per sq ft)\n"
210-
++ "toDouble(distance) / toDouble(time) = 10 (speed)\n"
211-
++ "toDouble(num_people) * toDouble(rejection_rate) = 9 (expected rejections)\n"
212-
++ "toDouble(revenue) - toDouble(costs) = 10 (profit)\n"
213-
++ "toDouble(height) + toDouble(weight) = 2 (adding length to mass)\n"
214-
++ "Output format: Just the digit, e.g., 2\n"
215-
++ "Think very carefully about each but only give me the final answer.\n"
216-
++ "Expression: "
217-
218-
score :: Expr a -> Int
219-
score expr =
220-
let
221-
genOp =
222-
defaultGenerateOps
223-
{ modelName = "llama3"
224-
, prompt = T.pack (instructions ++ prettyPrint expr)
225-
}
226-
llamaConfig = Just (defaultOllamaConfig{hostUrl = "http://127.0.0.1:8080"})
227-
result = unsafePerformIO $ try @SomeException (generate genOp llamaConfig)
228-
in
229-
case result of
230-
Right (Right response) ->
231-
let llmResponse = genResponse response
232-
s = fst $ either error id $ decimal @Int llmResponse
233-
in trace (prettyPrint expr ++ ": " ++ show s) s
234-
_ -> 7
235-
236187
numericExprs ::
237188
SynthConfig -> DataFrame -> [Expr Double] -> Int -> Int -> [Expr Double]
238189
numericExprs cfg df prevExprs depth maxDepth
@@ -256,8 +207,7 @@ numericExprs cfg df prevExprs depth maxDepth
256207
(disallowedCombinations cfg)
257208
)
258209
)
259-
concat [[e1 + e2, e1 - e2] | score (e1 + e2) > 5]
260-
++ concat [[e1 * e2, F.ifThenElse (e2 ./= 0) (e1 / e2) 0] | score (e1 * e2) > 5]
210+
[e1 + e2, e1 - e2, e1 * e2, F.ifThenElse (e2 ./= 0) (e1 / e2) 0]
261211

262212
boolExprs ::
263213
DataFrame -> [Expr Bool] -> [Expr Bool] -> Int -> Int -> [Expr Bool]

0 commit comments

Comments
 (0)