金若愚的blog

你好


  • 首页

  • 标签

  • 分类

  • 归档

cost function

发表于 2018-01-20 | 阅读次数:
字数统计: 1,440 | 阅读时长 ≈ 5

Cost Function与Gradient Descent

1. 定义

为了在假设空间中选取最优的模型,引入了损失函数和风险函数,损失函数度量模型一次预测的好坏,风险函数度量了平均意义下模型预测的好坏。

阅读全文 »

three elements

发表于 2018-01-19 | 阅读次数:
字数统计: 264 | 阅读时长 ≈ 1

统计方法三要素

在《统计学方法》一书中,作者将统计学算法表达为如下公式(1)

其中

  1. 模型就是所要学习的条件概率分布或决策函数。
  2. 策略就是用损失函数(cost function/loss function)来度量预测错误程度算法就是求解过程
  3. 算法就是求解模型的办法。

按照我的理解:

  1. 模型:找到一个合适的预测函数$h(\theta)$,用来预测输入的数据的判断结果,需要到数据和结果有一个分析和了解,明确问题,知道$h(\theta)$的大概形式。
  2. 构造一个损失函数$J(\theta)$,表示预测$\hat y$与训练数据的真实值$y$的偏差。可以是求差值或者是求对数损失。综合考虑所有训练数据的损失,
  3. 显然,$J(\theta)$的值越小,$h(\theta)$的越准确,所以我们显然要找到$J(\theta)$的最小值。我们一般使用的方法有梯度下降。

关于hexo的next主题无法显示latex公式

发表于 2018-01-18 | 阅读次数:
字数统计: 330 | 阅读时长 ≈ 1

reference: http://2wildkids.com/2016/10/06/%E5%A6%82%E4%BD%95%E5%A4%84%E7%90%86Hexo%E5%92%8CMathJax%E7%9A%84%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98/#%E5%B0%8F%E7%BB%93

Thanks 林肯先生

在next里写latex时发现渲染不出来,查找后发现是说node.js的渲染和markdown渲染的问题。操作半天也不得行。

但我发现我是什么公式也渲染不出来啊!后来在next的issue里面查找相关问题,发现得先在/themes/next/_config.yml里把third-party-services settings中的math设置为enable

1
2
mathjax:
enable: true

感觉被自己蠢到了。

但是这样设置以后还是不行,参考了”林肯先生”的做法。

  1. npm uninstall hexo-renderer-marked --save//先删除原先的markdown渲染工具
  2. npm install hexo-renderer-kramed --save//安装新的markdown渲染工具

由于markdown在渲染时”_ “会被认为是下划线,和latex下标的操作一样,会先渲染markdown的,导致latex无法渲染,因此要在里面加\把_转义,到这个时候才和”林肯先生”的问题一样,我有点震惊。

1
$R\_{m \times n} = U\_{m \times m} S\_{m \times n} V\_{n \times n}'$

很强,但是能用了,饿死了先去吃饭了,如果有哪位朋友知道这该怎么办,请告诉我一下。

Maximum Product subarray

发表于 2018-01-18 | 阅读次数:
字数统计: 908 | 阅读时长 ≈ 4

152.Maximum-Product-SubaArray

1. Description:

Find the contiguous subarray within an array (containing at least one number) which has the largest product.

1
2
3
For example, given the array[2,3,-2,4]`,

the contiguous subarray [2,3] has the largest product = 6.

2. Difficulty:

Medium

3. Solution:

阅读全文 »

461. Hamming Distance

发表于 2017-11-27 | 阅读次数:
字数统计: 830 | 阅读时长 ≈ 4

461. Hamming Distance

1. Description:

The Hamming distance between two integers is the number of positions at which the corresponding bits are different.

Given two integers x and y, calculate the Hamming distance.

Note:
0 ≤ x, y < 231.

Example:

1
2
3
4
5
6
7
8
9
10
Input: x = 1, y = 4

Output: 2

Explanation:
1 (0 0 0 1)
4 (0 1 0 0)
↑ ↑

The above arrows point to positions where the corresponding bits are different.
阅读全文 »
1…345
金若愚

金若愚

25 日志
11 标签
RSS
GitHub 微博 匹兹堡 E-Mail
© 2018 金若愚
由 Hexo 强力驱动
|
主题 — NexT.Pisces v5.1.3