Skip to content

22222222z/2z

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

2z

h2

h4

link to 22z


a link to apple.com


local image

image


web image

image


    using namespace std;
    for(int i = 0;i < 100 ;i ++)
    cout<<i<<endl;
    import torch
    import numpy as np
    import matplotlib.pyplot as plt

    x_data = [1.0, 2.0, 3.0]
    y_data = [2.0, 4.0, 6.0]

    def forward(x):
        return x * w

    def loss(x, y):
        y_pred = forward(x);
        return (y_pred - y) * (y_pred - y)

    w_list = []
    mse_list = []

    for w in np.arange(0.0, 4.1, 0.1):
        print('w = ',w)
        l_sum = 0
        for x_val,y_val in zip(x_data, y_data):
            y_pred_val = forward(x_val)
            loss_val = loss(x_val, y_val)
            l_sum += loss_val
            print('\t',x_val, y_val, y_pred_val, loss_val)
        print('MSE = ',l_sum / 3)
        w_list.append(w)
        mse_list.append(l_sum / 3)

        #绘图
        plt.plot(w_list, mse_list)
        plt.ylabel('Loss')
        plt.xlabel('w')
        plt.show()

a block quote


  1. 123
  2. 456
  3. 789
  4. 987
  • first
  • second
  • third

head1 head2 head3
content1 content2 content3
content content content

bold text


italicized text


cu xie ti


delete


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published