12 lines
441 B
TypeScript
12 lines
441 B
TypeScript
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);
|