Siyao's Blog


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 搜索

test

发表于 2017-03-22
字数统计: 76 | 阅读时长 ≈ 1
count.py ++class Solution {public: int getSum(int a, int b) { int c = a & b;//进位位置 int result = a^b; while (c) { c = c << 1; int t = c; c = result & c; result = result ^ t; } return result; }}; class ...
阅读全文 »

Hexo下Markdown与MathJax冲突问题

发表于 2017-03-22 | 分类于 blog config
字数统计: 378 | 阅读时长 ≈ 1
问题用markdown写博客,mathjax解析数学公式,二者对于一些符号会发生冲突,到时公式无法正确解析: _的转义,在markdown中,_是斜体,但是在latex中,是下标测意思,会出现冲突 \\的换行,在markdown中,\\会被转义为\,这样也会影响影响mathjax对公式中的\\进行渲染 *的转义,在markdown中,* 是加粗 原因hexo默认使用marked.js去解析我们写的markdown,比如一些符号,_代表斜体,会被处理为<em>标签,比如x_i在开始被渲染的时候,处理为x<em>i</em>,这个时候mathjax就无法渲染 ...
阅读全文 »

FFM(field-aware Factorization Machine)——升级版FM

发表于 2017-03-22 | 分类于 machine learning
字数统计: 782 | 阅读时长 ≈ 3
背景 FFM(Field-aware Factorization Machine)最初的概念来自Yu-Chin Juan(阮毓钦,毕业于中国台湾大学,现在美国Criteo工作)与其比赛队员,是他们借鉴了来自Michael Jahrer的论文中的field概念提出了FM的升级版模型 原理线性模型对于给定的数据我们进行训练,进而对测试集进行预测,首先我们想到利用线性模型进行拟合(也就是一维特征): 进一步,我们考虑加入二维组合特征进行拟合: FM 也就是FM中的交叉特征(二次项),采用矩阵分解得到如下形式: 其中$w_{j_1}$和$w_{j_2}$分别为特征$j_1$和$j_1$对应 ...
阅读全文 »

【leetcode】371. Sum of Two Integers

发表于 2017-03-18 | 分类于 leetcode
字数统计: 237 | 阅读时长 ≈ 1
题目Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, return 3. 问题陈述:求两个整数和,不能用加法 题目思路:想到了转化成2进制再求和 异或(^)操作:1^0 = 0^1 = 1,0^0 = 1^1 = 0,先求出不考虑进位情况下的各位数字相加的运算结果d 和(&)操作:1^1 = 1,1^0 = 0^1 = 0^0 = 0,然后求出两个数字对应位置都是1的位,也就是需要进 ...
阅读全文 »

【LeetCode】283. Move Zeros

发表于 2017-03-18 | 分类于 leetcode
字数统计: 185 | 阅读时长 ≈ 1
题目Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0]. Note:You must do this in-place without making a copy of th ...
阅读全文 »

【LeetCode】104. Maximum Depth of Binary Tree

发表于 2017-03-17 | 分类于 leetcode
字数统计: 272 | 阅读时长 ≈ 1
题目Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 问题陈述:求二叉树的深度 题目思路: 广度优先遍历:利用STL中的queue(队列)进行广度优先遍历,计算层数 深度优先遍历:递归调用,当前节点的高度=max(左孩子节点高度,右孩子结点高度)+ 1 代码:/** * Definition for a binary tree ...
阅读全文 »

交叉熵

发表于 2017-03-16 | 分类于 machine learning
字数统计: 392 | 阅读时长 ≈ 1
熵衡量随机变量X的不确定性,熵越大表示随机变量的不确定性越大,即混乱程度越大,等概率分布时,熵最大,为1。 随机变量$X$可能的取值$X=\lbrace x_1,x_2,\cdots,x_n \rbrace$,对应的概率为$p(X=x_i)(i=1,2,\cdots,n)$,随机变量$X$的熵定义为 $H(X) = -{\sum_{i}^{n}{p(x_i)\log{p(x_i)}}}$ 交叉熵对一随机事件,其真实概率分布为p(i),从数据中得到的概率分布为q(i),则我们定义,交叉熵为: 相对熵又称KL散度,描述两个随机分布间距离的度量 $D(p||q)=H(p,q)-H(p)=\sum ...
阅读全文 »

【leetcode】136. Single Number

发表于 2017-03-15 | 分类于 leetcode
字数统计: 1,090 | 阅读时长 ≈ 4
题目Given an array of integers, every element appears twice except for one. Find that single one. 问题陈述:输入序列中,每个数字重复出现2次,唯有一个数字只出现一次,找到这个只出现一次的数字 题目思路: hash_table:遍历输入数组,如果hashtable中没有,说明是第一次出现,存到hash table中,如果发现hashtable中已经有了说明是第二次出现,z在hash表中将其删掉,最终hash table中剩下的就是只出现一次的那个数字 bit manipulation:数组中所有数字做异 ...
阅读全文 »

Factorization Machine(FM,因子分解机)

发表于 2017-03-14 | 分类于 machine learning
字数统计: 1,126 | 阅读时长 ≈ 4
背景 Steffen Rendle于2012年提出FM模型,旨在解决稀疏矩阵下的特征组合问题。传统机器学习问题,一般仅考虑如何对特征赋予权重,而没有考虑特征间存在相互作用,FM模型的提出较好地解决了该问题。 相比于SVM的优势 对于稀疏数据有更强的学习能力 线性时间复杂度,不依赖于支撑向量 应用 回归问题 二分类问题 排序 原理传统线性回归模型我们用广告的CTR(点击率)预估问题引出FM模型:根据用户和广告位等相关特征,预测用户是否点击广告。源数据如下 Clicked? Country Day Ad_type 1 USA 26/11/15 Movie 0 China ...
阅读全文 »

【leetcode】412. Fizz Buzz

发表于 2017-03-13 | 分类于 leetcode
字数统计: 222 | 阅读时长 ≈ 1
题目Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five output “FizzBuzz”. Example: n = 15,Return:[ ...
阅读全文 »
1…101112
Siyao

Siyao

siyao小朋友画圈圈的地方

120 日志
25 分类
32 标签
© 2017 — 2018 Siyao
由 Hexo 强力驱动
|
主题 — NexT.Pisces
| Site words total count: 222.8k
访问人次 次 总访问量 次