Skip to content

Commit c75eb6f

Browse files
authored
feat(lib): Support mapping a column to multiple columns (#189)
* feat(lib): Support mapping a column to multiple columns Extremely useful for classification. * test(lib): Resolve flattening test flakiness * ci(config): Integrate with Mergeable * ci(config): Integrate with Dependabot * build(deps-dev): Fix security issues * docs(lib): Add flatten to advanced usage example
1 parent e504478 commit c75eb6f

18 files changed

+672
-3098
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = {
3535
'newlines-between': 'always',
3636
},
3737
],
38+
'sonarjs/cognitive-complexity': ['error', 18],
3839
},
3940
overrides: [
4041
{

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
# Fetch and update latest `npm` packages
4+
- package-ecosystem: npm
5+
directory: '/'
6+
schedule:
7+
interval: daily
8+
time: '00:00'
9+
open-pull-requests-limit: 10
10+
reviewers:
11+
- isair
12+
assignees:
13+
- isair

.github/mergeable.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: 2
2+
mergeable:
3+
- when: pull_request.*
4+
validate:
5+
- do: assignee
6+
min:
7+
count: 1
8+
- do: approvals
9+
min:
10+
count: 1
11+
block:
12+
changes_requested: true
13+
- do: title
14+
must_include:
15+
regex: '^[a-z]+\([a-z-]+\): [A-Z]{1}(.+)$'
16+
- do: dependent
17+
changed:
18+
file: 'package.json'
19+
required: ['package-lock.json']
20+
21+
- when: schedule.repository
22+
validate:
23+
- do: stale
24+
days: 20
25+
type: pull_request, issues
26+
pass:
27+
- do: comment
28+
payload:
29+
body: This is old. Is it still relevant?
30+
31+
- when: pull_request.*, pull_request_review.*, status.*, check_suite.*
32+
name: 'Automatically merge pull requests once it passes all checks'
33+
validate: []
34+
pass:
35+
- do: merge
36+
merge_method: 'squash'

.github/workflows/check-pr.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ const {
6565
labelColumns: ['temperature'],
6666
mappings: {
6767
height: (ft) => ft * 0.3048, // feet to meters
68-
temperature: (f) => (f - 32) / 1.8, // fahrenheit to celsius
68+
temperature: (f) => (f < 50 ? [1, 0] : [0, 1]), // cold or hot classification
6969
}, // Map values based on which column they are in before they are loaded into tensors.
70+
flatten: ['temperature'], // Flattens the array result of a mapping so that each member is a new column.
7071
shuffle: true, // Pass true to shuffle with a fixed seed, or a string to use it as a seed for the shuffling.
7172
splitTest: true, // Splits your data in half. You can also provide a certain row count for the test data, or a percentage string (e.g. 10%).
7273
prependOnes: true, // Prepends a column of 1s to your features and testFeatures tensors, useful for linear regression.

assets/csv/empty.csv

Whitespace-only changes.

assets/csv/headers.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test,headers,should,fail

commitlint.scopes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = [
44
'github',
55
'script',
66
'deps',
7-
'dev-deps',
7+
'deps-dev',
88
'asset',
99
'lib',
1010
'release',

dangerfile.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)