-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjunk
59 lines (49 loc) · 1.47 KB
/
junk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// const y = tf.oneHot(tf.tensor1d(labels, "int32"), numClasses);
// const history = await model.fit(x, y, { epochs: 50 });
// Overly complex model below
// Define the model architecture
// const model = tf.sequential();
// model.add(
// tf.layers.dense({
// inputShape: [48],
// units: 128,
// activation: "relu",
// kernel_regularizer: tf.regularizers.l2({ l2: 0.005 }),
// })
// );
// model.add(tf.layers.dropout({ rate: 0.5 }));
// model.add(
// tf.layers.dense({
// units: 64,
// activation: "relu",
// kernel_regularizer: tf.regularizers.l2({ l2: 0.05 }),
// })
// );
// model.add(tf.layers.dropout({ rate: 0.5 }));
// model.add(
// tf.layers.dense({
// units: numClasses,
// activation: "softmax",
// })
// );
// // Compile the model
// model.compile({
// optimizer: "adam",
// loss: "categoricalCrossentropy",
// metrics: ["accuracy"],
// });
// const features = [];
// const labels = [];
// // shuffle the data
// // let shuffled = resultsArray.sort(() => 0.5 - Math.random());
// // Prepare the data
// for (let i = 0; i < newResultsArray.length; i++) {
// features.push(newResultsArray[i][0]);
// labels.push(newResultsArray[i][1]);
// }
// const fLength = features.length;
// console.log(features, "features");
// console.log(labels, "labels");
// const x = tf.tensor2d(features, [fLength, 48]);
// const y = tf.oneHot(tf.tensor1d(labels, "int32"), numClasses);
// const history = await model.fit(x, y, { epochs: 500 });