Skip to content

Commit 588c28c

Browse files
committed
Update examples
1 parent df0ee36 commit 588c28c

File tree

25 files changed

+136
-340
lines changed

25 files changed

+136
-340
lines changed

examples/fraud/implementations/models/dnn.py

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
def transform_spark(data, columns, args, transformed_column_name):
1+
def transform_spark(data, input, transformed_column_name):
22
import pyspark.sql.functions as F
33

4-
distribution = args["class_distribution"]
4+
distribution = input["class_distribution"]
55

66
return data.withColumn(
77
transformed_column_name,
8-
F.when(data[columns["col"]] == 0, distribution[1]).otherwise(distribution[0]),
8+
F.when(data[input["col"]] == 0, distribution[1]).otherwise(distribution[0]),
99
)

examples/fraud/resources/apis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- kind: api
22
name: fraud
3-
model_name: dnn
3+
model: @dnn
44
compute:
55
replicas: 1

examples/fraud/resources/dnn.yaml

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

examples/fraud/resources/models.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
- kind: model
2+
name: dnn
3+
estimator: cortex.dnn_classifier
4+
target_column: @class
5+
input:
6+
num_classes: 2
7+
numeric_columns:
8+
[@time_normalized, @v1_normalized, @v2_normalized, @v3_normalized, @v4_normalized,
9+
@v5_normalized, @v6_normalized, @v7_normalized, @v8_normalized, @v9_normalized,
10+
@v10_normalized, @v11_normalized, @v12_normalized, @v13_normalized, @v14_normalized,
11+
@v15_normalized, @v16_normalized, @v17_normalized, @v18_normalized, @v19_normalized,
12+
@v20_normalized, @v21_normalized, @v22_normalized, @v23_normalized, @v24_normalized,
13+
@v25_normalized, @v26_normalized, @v27_normalized, @v28_normalized, @amount_normalized]
14+
training_input:
15+
weight_column: @weight_column
16+
hparams:
17+
hidden_units: [100, 100, 100]
18+
training:
19+
num_steps: 5000

examples/fraud/resources/normalize.yaml

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

examples/fraud/resources/normalized_columns.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
- kind: template
2+
name: normalize
3+
yaml: |
4+
- kind: aggregate
5+
name: {column}_mean
6+
aggregator: cortex.mean
7+
input: @{column}
8+
9+
- kind: aggregate
10+
name: {column}_stddev
11+
aggregator: cortex.stddev
12+
input: @{column}
13+
14+
- kind: transformed_column
15+
name: {column}_normalized
16+
transformer: cortex.normalize
17+
input:
18+
col: @{column}
19+
mean: @{column}_mean
20+
stddev: @{column}_stddev
21+
122
- kind: embed
223
template: normalize
324
args:

examples/fraud/resources/raw_columns.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
path: s3a://cortex-examples/fraud.csv
66
csv_config:
77
header: true
8-
schema: [time, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, amount, class]
8+
schema: [@time, @v1, @v2, @v3, @v4, @v5, @v6, @v7, @v8, @v9, @v10, @v11, @v12, @v13, @v14, @v15, @v16, @v17, @v18, @v19, @v20, @v21, @v22, @v23, @v24, @v25, @v26, @v27, @v28, @amount, @class]
99

1010
- kind: raw_column
1111
name: time
Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
11
- kind: aggregate
22
name: class_distribution
33
aggregator: cortex.class_distribution_int
4-
inputs:
5-
columns:
6-
col: class
7-
8-
- kind: transformer
9-
name: weight
10-
inputs:
11-
columns:
12-
col: INT_COLUMN
13-
args:
14-
class_distribution: {INT: FLOAT}
15-
output_type: FLOAT_COLUMN
4+
input: @class
165

176
- kind: transformed_column
187
name: weight_column
19-
transformer: weight
20-
inputs:
21-
columns:
22-
col: class
23-
args:
24-
class_distribution: class_distribution
8+
transformer_path: implementations/transformers/weight.py
9+
input:
10+
col: @class
11+
class_distribution: @class_distribution

examples/insurance/implementations/models/dnn.py

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

0 commit comments

Comments
 (0)