MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / csvTransform

Function csvTransform

baseball-node/strike_zone.js:41–48  ·  view source on GitHub ↗
({xs, ys})

Source from the content-addressed store, hash-verified

39// Converts a row from the CSV into features and labels.
40// Each feature field is normalized within training data constants:
41const csvTransform = ({xs, ys}) => {
42 const values = [
43 normalize(xs.px, PX_MIN, PX_MAX), normalize(xs.pz, PZ_MIN, PZ_MAX),
44 normalize(xs.sz_top, SZ_TOP_MIN, SZ_TOP_MAX),
45 normalize(xs.sz_bot, SZ_BOT_MIN, SZ_BOT_MAX), xs.left_handed_batter
46 ];
47 return {xs: values, ys: ys.is_strike};
48};
49
50const trainingData =
51 tf.data.csv(TRAIN_DATA_PATH, {columnConfigs: {is_strike: {isLabel: true}}})

Callers

nothing calls this directly

Calls 1

normalizeFunction · 0.70

Tested by

no test coverage detected