-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
157 additions
and
2,505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Regularization | ||
|
||
Model 就是一堆 W0 * W1 + W1 * X1 + ... + Wn * Xn | ||
x 是 feature | ||
train 的過程是去找一組 w 來使得這個多項式最符合 data,或是錯誤最少 | ||
|
||
L1 正規化 w 取絕對值 | ||
L2 正規化 w 取平方 | ||
|
||
為了控制正規化 (tune the overall impact of the regularization),會加上一個 lambda | ||
|
||
|
||
Early stopping | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# React with webpack and babel | ||
|
||
## Initial Project | ||
|
||
建立一個空專案並且產生 package.json | ||
|
||
```sh | ||
mkdir myapp | ||
cd myapp | ||
npm init -y | ||
``` | ||
|
||
* npm init 使用 -y 可以略過所有問題 | ||
|
||
## Install Webpack, React and Babel | ||
|
||
<strong>Install Webpack</strong> | ||
|
||
```sh | ||
npm i webpack@4 webpack-cli@3 -D | ||
``` | ||
|
||
* -D: -save-dev | ||
|
||
<strong>Install React</strong> | ||
|
||
```sh | ||
npm i react@16 react-dom@16 -S | ||
``` | ||
|
||
* -S: --save | ||
|
||
<strong>Install Babel</strong> | ||
|
||
```sh | ||
npm i babel-loader@8 @babel/core @babel/preset-env @babel/preset-react -D | ||
``` | ||
|
||
<strong>Install html-webpack-plugin</strong> | ||
|
||
```sh | ||
npm i html-webpack-plugin -D | ||
``` | ||
|
||
<strong>Install webpack-dev-server</strong> | ||
|
||
```sh | ||
npm i webpack-dev-server -D | ||
``` | ||
|
||
並修改 package.json | ||
|
||
```json | ||
... | ||
"scripts": { | ||
"start": "webpack-dev-server --mode development --open", | ||
"build": "webpack --mode production" | ||
}, | ||
... | ||
``` | ||
|
||
<strong>Install css-loader and style-loader</strong> | ||
|
||
```sh | ||
npm i css-loader style-loader -D | ||
``` | ||
|
||
## 建立 webpack.config.js 與 .babelrc | ||
|
||
<strong>webpack.config.js</strong> | ||
|
||
```js | ||
const HtmlWebPackPlugin = require('html-webpack-plugin'); | ||
|
||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader' | ||
} | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: ['style-loader', 'css-loader'] | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new HtmlWebPackPlugin({ | ||
template: './src/index.html', | ||
filename: './index.html' | ||
}) | ||
] | ||
}; | ||
``` | ||
|
||
<strong>.babelrc</strong> | ||
|
||
```json | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"] | ||
} | ||
``` |
Oops, something went wrong.