Verified Commit 9d0458cb authored by Kiryuu Sakuya's avatar Kiryuu Sakuya 🎵
Browse files

Update 12

parent 83d122af
test
\ No newline at end of file
# Tensorflow.js 学习
## 文件目录构造
> 点击名称即可看到网页示例,一般输出都在控制台。
- [first-test](https://test.251.sh/tensorflow/first-test/) 是测试代码。
## 作业要求
实现鸢尾花分类的web端程序。
代码实现作为周四的任务。完成后发送邮件到我 QQ 邮箱,邮件主题:鸢尾花分类 web 端,代码以附件发送,附件以学号命名。
\ No newline at end of file
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.pnp.*
# Others
test
\ No newline at end of file
This diff is collapsed.
{
"name": "my-tensorflow_js-homework",
"version": "0.0.1",
"description": "ur mom gay",
"private": true,
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"tensorflow.js"
],
"author": "Kiryuu Sakuya",
"license": "WTFPL",
"dependencies": {
"@tensorflow/tfjs": "^1.7.2"
},
"devDependencies": {
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11"
}
}
\ No newline at end of file
import * as tf from '@tensorflow/tfjs';
// Define a model for linear regression.
const model = tf.sequential();
model.add(tf.layers.dense({ units: 1, inputShape: [1] }));
// Prepare the model for training; Specify the loss and the optimizer.
model.compile({ loss: "meanSquaredError", optimizer: "sgd" });
// Generate some synthetic data for training.
const xs = tf.tensor2d([1, 2, 3, 4], [4, 1]);
const ys = tf.tensor2d([1, 3, 5, 7], [4, 1]);
// Train the model using the data.
model.fit(xs, ys, { epochs: 10 }).then(() => {
// Use the model to do inference on a data point the model hasn't seen before:
// Open the browser devtools to see the output
model.predict(tf.tensor2d([5], [1, 1])).print();
});
\ No newline at end of file
const path = require('path');
module.exports = {
entry: './src/index.js',
output: { path: path.resolve(__dirname, 'dist'), filename: 'main.js' },
devServer: {
historyApiFallback: true,
noInfo: true,
host: '0.0.0.0',
disableHostCheck: true
}
};
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Javascript</title>
</head>
<body>
<p>Hello World!</p>
</body>
<script>
console.log("Hello World!")
</script>
</html>
\ No newline at end of file
{
"name": "My Tensorflow.js Homework",
"version": "0.1",
"description": "ur mom gay",
"main": "index.js",
"license": "WTFPL"
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment