Giter Site home page Giter Site logo

ai-math-experiment's Introduction

AI-Math-Experiment

Python code of experiment from Harbin Institute of Technology's Essential Mathematics for AI.

哈工大2023人工智能数学基础实验课Python代码。

有问题欢迎发issue,能给我一个Star,就更好啦!

说在前面

本repo里的内容可能没有完全覆盖到实际的实验要求,还请谅解。

克隆到本地:

git clone https://github.com/coder109/AI-Math-Experiment

安装一些依赖库:

pip install -r requirements.txt

lab2下创建文件夹mnist,将mnist_train.csv文件放在该文件夹下。该文件请访问这里下载:https://github.com/phoebetronic/mnist

LAB1

本LAB有三个要求:

  1. 用RANSAC和最小二乘法尝试拟合一条直线。
  2. 用RANSAC和最小二乘法尝试拟合一条曲线。
  3. 假设给定函数,从中生成n个点,添加随机噪声,然后用拟合、回归和神经网络的方法来求解模型, 使得模型误差最小!
  4. 添加外点,查看拟合的效果。

这个共有3个文件,作用如下:

  • Fitting.py,具体的函数实现。需要注意的是,在本文件中,我加入了添加外点的功能,若不需要该功能,请自行修改generateNoises函数。
  • CurveFitting.py,拟合曲线的主函数。
  • Straight.py,拟合直线的主函数。
  • 数学基础实验1.ipynb,第三个问题的实现。

LAB2

本实验要求为,通过PCARPCAMNIST数据集进行分类。

在本例中,文件作用如下:

  1. mnist文件夹,及其下面的mnist_train.csv文件,为MNIST数据集文件。
  2. PCA.py,解决问题主函数。
  3. RPCA.py,鲁棒主成分分析的相关代码,感谢https://github.com/dganguli/robust-pca

LAB3

本实验有两个可选任务:

  1. 实现用梯度下降求解二项逻辑回归模型,然后牛顿法求解一个高维的非线性问题。
  2. 使用mnist,cifar数据集用于训练,在训练的优化算法中,采用梯度下降,牛顿法,以及各种加速技术进行训练速度和轮次,以及精度的比较。

在本例中,文件作用如下:

  1. LogisticRegression.py,牛顿法求解三维逻辑回归模型。
  2. Gradient.py,梯度下降求解二项逻辑回归模型。
  3. Acceleration.py,求解第二个问题的代码,使用mnist数据。还没有写完,因为训练耗时很长。

ai-math-experiment's People

Contributors

coder109 avatar

Stargazers

 avatar LEFT_Picasso avatar Yiheng Zheng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.