phase 1
This commit is contained in:
11
scripts/predict.ts
Normal file
11
scripts/predict.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as tf from "@tensorflow/tfjs-node";
|
||||
|
||||
async function predict(factors: number[]) {
|
||||
const model = await tf.loadLayersModel("file://sample/model/model.json");
|
||||
const input = tf.tensor2d([factors]);
|
||||
const prediction = model.predict(input) as tf.Tensor;
|
||||
console.log(`Predicted Constant: ${prediction.dataSync()[0].toFixed(2)}`);
|
||||
}
|
||||
|
||||
// 예시: [physical, stamina, tech, reading]
|
||||
predict([12.5, 26, 0.41, 0.0]).catch(console.error);
|
||||
Reference in New Issue
Block a user