Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lift tech.v3.datatype.functional operations #90

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
b89c4f9
Add ->general-types function
ezmiller Aug 19, 2022
f40aa7f
Add a general type :logical
ezmiller Aug 19, 2022
3377993
Use type hierarchy in tablecloth.api.utils for `typeof` functions
ezmiller Aug 19, 2022
ff05218
Merge remote-tracking branch 'origin/master' into ethan/column-type-api
ezmiller Aug 19, 2022
ab54530
Add column dev branch to pr workflow
ezmiller Aug 19, 2022
30e9fc5
Merge remote-tracking branch 'origin/ethan/column-api-dev-branch-1' i…
ezmiller Aug 19, 2022
6ee56c1
Add tests for typeof
ezmiller Aug 19, 2022
36200be
Fix tests for typeof
ezmiller Aug 19, 2022
170519d
Return the concrete type from `typeof`
ezmiller Sep 16, 2022
59c2755
Simplify `concrete-types` fn
ezmiller Sep 16, 2022
d4895d9
Optimize ->general-types by using static lookup
ezmiller Sep 28, 2022
d93e34f
Adjust fns listing types
ezmiller Sep 28, 2022
5061d8c
Revert "Adjust fns listing types"
ezmiller Oct 3, 2022
e399489
Fix `typeof` test to test for concerete types
ezmiller Oct 3, 2022
7ce2ee6
Reorganize `typeof?` tests
ezmiller Oct 3, 2022
7c0b949
Reword docstring for `typeof?` slightly
ezmiller Oct 3, 2022
82ff58b
Update column api template and add missing `typeof?`
ezmiller Oct 3, 2022
e1cfd3c
Add commment to `general-types-lookup`
ezmiller Oct 3, 2022
947c85e
Improve `->general-types` docstring
ezmiller Oct 3, 2022
37b7618
Add `general-types` fn that returns sets of general types
ezmiller Oct 3, 2022
8b209e3
Adjust util `types` fn to return concrete types
ezmiller Oct 3, 2022
1b23e81
Save changes to column api.clj
ezmiller Nov 11, 2022
6b3eb1b
Save ongoing experiments with lifting
ezmiller Nov 11, 2022
e0cfdf9
Save ongoing work on lifting
ezmiller Nov 14, 2022
35892c6
Adjust lift-ops-1 to handle any number of args with rest arg
ezmiller Nov 14, 2022
6bdd90a
Working `rearrange-args` fn
ezmiller Nov 17, 2022
3469043
Save work actually writing lifted fns
ezmiller Nov 22, 2022
ceb66a2
Saving first attempt to writer operators
ezmiller Nov 23, 2022
f46a3ba
Add `percentiiles test
ezmiller Nov 23, 2022
64644d7
Adjust `rearrange-args to take new-args in option map
ezmiller Nov 23, 2022
7e15113
Unify two lift functions
ezmiller Nov 24, 2022
8d711b3
Add in docstrings when present
ezmiller Nov 24, 2022
3c18c98
Move lift utils into utils ns
ezmiller Nov 24, 2022
dd98747
Rename lifting namespaces
ezmiller Nov 26, 2022
3a9cc03
Lift some more fns
ezmiller Nov 27, 2022
83f7b4c
Make exclusions for ns header helper an arg
ezmiller Nov 29, 2022
dcc6602
Add new operators and tests
ezmiller Nov 29, 2022
a47bf21
Add ops with lhs rhs arg pattern
ezmiller Nov 29, 2022
936a029
Lift '*
ezmiller Nov 29, 2022
8679f17
Merge branch 'ethan/column-api-dev-branch-1' into ethan/lift-dtype-ne…
ezmiller Nov 30, 2022
eb139c2
Add require to operators ns for utils
ezmiller Nov 30, 2022
443c980
Update test to make it more complete
ezmiller Dec 29, 2022
8375035
Lift `equals
ezmiller Dec 29, 2022
d842659
Make test more accurate
ezmiller Dec 29, 2022
a566215
Reorganize tests
ezmiller Dec 29, 2022
496f8dc
Fix grammar
ezmiller Dec 29, 2022
437829b
Lift 'shift
ezmiller Dec 29, 2022
97a398f
Uncomment 'or test
ezmiller Dec 29, 2022
ee15b36
Lift 'normalize op
ezmiller Dec 29, 2022
8cff8c1
Life 'magnitude
ezmiller Dec 29, 2022
c5ef157
Lifting bit manipulation ops
ezmiller Jan 9, 2023
f89f65a
lift ieee-remainder
ezmiller Jan 16, 2023
adfa1ff
Lifting more functions
ezmiller Jan 16, 2023
561428d
Add excludes
ezmiller Jan 16, 2023
817dc3c
Merge remote-tracking branch 'origin/master' into ethan/lift-dtype-ne…
ezmiller Jan 20, 2023
666e614
Lift a bunch of new functions
ezmiller Jan 22, 2023
ab2fb93
Alphebetize some lists
ezmiller Jan 22, 2023
4a8e61f
More alphebitization
ezmiller Jan 22, 2023
f844fdd
Clean up
ezmiller Jan 23, 2023
91674a1
Instead of using `col` as arg conform to using `x & and `y
ezmiller Jan 23, 2023
49e5cb0
Temporarily disable failing test fix in 7.000-beta23
ezmiller Jan 23, 2023
ff4eea6
Disable the correct test
ezmiller Jan 23, 2023
451d426
Just some minor cleanup in op tests
ezmiller Jan 23, 2023
017ad82
Some more cleanup/reorg in op tests
ezmiller Jan 23, 2023
af4cb4d
Merge branch 'ethan/column-api-dev-branch-1' into ethan/lift-dtype-ne…
ezmiller Jan 23, 2023
f9ad897
Update generated operators namespace with switch from col -> x etc
ezmiller Jan 23, 2023
c1edbca
Lift 'descriptive-statistics
ezmiller Jan 23, 2023
09faa4e
Fix messed up test layout
ezmiller Jan 23, 2023
ac125db
Lift 'quartiles
ezmiller Jan 23, 2023
a63425b
Lift 'fill-range and a bunch of reduce operations
ezmiller Jan 23, 2023
b4eb36f
Lift 'mean-fast 'sum-fast 'magnitude-squared
ezmiller Jan 23, 2023
8c95124
Lift correlation fns
ezmiller Jan 27, 2023
9f0f733
Lift cumulative ops
ezmiller Jan 27, 2023
4fee5df
cleanup
ezmiller Feb 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 195 additions & 0 deletions src/tablecloth/column/api/lift_operators.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
(ns tablecloth.column.api.lift-operators
(:require [tablecloth.column.api.utils :refer [do-lift lift-op]]))

(def serialized-lift-fn-lookup
{['*
'+
'-
'/
'<
'<=
'>
'>=
'abs
'acos
'and
'asin
'atan
'atan2
'bit-and
'bit-and-not
'bit-clear
'bit-flip
'bit-not
'bit-or
'bit-set
'bit-shift-left
'bit-shift-right
#_bit-test ;; can't get this to work yet.
'bit-xor
'cbrt
'ceil
'cos
'cosh
'distance
'distance-squared
'dot-product
'eq
'equals
'exp
'expm1
'floor
'get-significand
'hypot
'identity
'ieee-remainder
'log
'log10
'log1p
'logistic
'magnitude
'max
'min
'next-down
'next-up
'normalize
'not-eq
'or
'pow
'quot
'rem
'rint
'signum
'sin
'sinh
'sq
'sqrt
'tan
'tanh
'to-degrees
'to-radians
'ulp
'unsigned-bit-shift-right] lift-op
['kurtosis
'sum
'mean
'skew
'variance
'standard-deviation
'quartile-3
'quartile-1
'median] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([col] [col options])
:new-args-lookup {'data 'col
'options 'options}}))
['even?
'finite?
'infinite?
'mathematical-integer?
'nan?
'neg?
'not
'odd?
'pos?
'round
'zero?]
(fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x] [x options])
:new-args-lookup {'arg 'x
'options 'options}}))
['percentiles] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x percentiles] [x percentiles options])
:new-args-lookup {'data 'x,
'percentages 'percentiles,
'options 'options}}))
['shift] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x n])
:new-args-lookup {'rdr 'x
'n 'n}}))
['descriptive-statistics] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x stats-names stats-data options]
[x stats-names options]
[x stats-names]
[x])
:new-args-lookup {'rdr 'x
'src-rdr 'x
'stats-names 'stats-names
'stats-data 'stats-data
'options 'options}}))
['quartiles] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x options] [x])
:new-args-lookup {'item 'x
'options 'options}}))
['fill-range] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x max-span])
:new-args-lookup {'numeric-data 'x
'max-span 'max-span}}))
['reduce-min
'reduce-max
'reduce-*
'reduce-+] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x])
:new-args-lookup {'rdr 'x}}))
['mean-fast
'sum-fast
'magnitude-squared] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x])
:new-args-lookup {'data 'x}}))
['kendalls-correlation
'pearsons-correlation
'spearmans-correlation] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x y] [x y options])
:new-args-lookup {'lhs 'x
'rhs 'y
'options 'options}}))
['cumprod
'cumsum
'cummax
'cummin] (fn [fn-sym fn-meta]
(lift-op
fn-sym fn-meta
{:new-args '([x] [x options])
:new-args-lookup {'data 'x
'options 'options}}))})


(defn deserialize-lift-fn-lookup []
(reduce (fn [m [symlist liftfn]]
(loop [syms symlist
result m]
(if (empty? syms)
result
(recur (rest syms) (assoc result (first syms) liftfn)))))
{}
serialized-lift-fn-lookup))

(comment
(do-lift (deserialize-lift-fn-lookup)
'tablecloth.column.api.operators
'tech.v3.datatype.functional
'[* + - / < <= > >= abs and bit-and bit-and-not bit-clear bit-flip
bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor
even? identity infinite? max min neg? not odd? odd? or pos? quot rem
unsigned-bit-shift-right zero?]
"src/tablecloth/column/api/operators.clj")
,)
Loading