一份2021年03月24日的信息流提炼
原发布地址:Digest | 斯坦福机器学习课程介绍
每天学点机器学习
斯坦福机器学习课程 1.介绍
Machine Learning |Offered By Standford
AI应用举例
- 数据挖掘 (用户大数据分析,生物学,医学, etc.)
- 无法手工产出的应用(自动驾驶,手写文字识别,NLP,computer viesion)
- 服务定制系统(各种用户推荐系统)
机器学习定义
Arthur Samuel(1959) Machine Learning: Field of study that gives computers the ability to learn without being explicitly programmed.
Arthur Samuel(1959) :赋予计算机在没有明确编程的情况下学习能力的研究领域。
Tom Mitchell (1998) Well-posed Learning Problem: A computer program is said to learn from experience E with respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E.
I actually think he came out with this definition just to make it rhyme. For the checkers playing examples, the experience E would be the experience of having the program play tens of thousands of games itself.
Tom Mitchell (1998) : 如果一个计算机程序在T上的表现,如P所衡量的那样,随着经验E的提高而提高,那么就可以说它从经验E中学习。
其实我觉得他出这个定义只是为了让它押韵。对于下跳棋的例子,经验E是让程序自己下几万盘棋的经验。任务T是下跳棋的任务,而性能衡量指标P是在下一局跳棋中与某个新对手对弈时获胜的概率。
有监督学习(Supervised Learning)
We also talked about the regression problem, and by regression that means that our goal is to predict a continuous valued output. We talked about the classification problem where the goal is to predict a discrete value output.
回归是指目标是预测一个连续值的输出 。 e.g. 根据大小预测房价
分类问题目标是预测一个离散值的输出。e.g. 根据年龄和肿瘤大小,预测肿瘤为良性(benign)还是恶性(malignant)。
无监督学习 (Unsupervised Learning)
应用例子
- 组织计算集群 Organize computing clusters
- SNS分析 Social network analysis
- 市场细分 Market segmentation
- 天文数据分析 Astronomical data analysis
聚类。把100万个不同的基因集合起来 找到一种方法来自动把这些基因分成不同的组,这些组通过不同的变量,如寿命、位置、角色等,以某种方式相似或相关。
e.g. news.google.com/
非聚类。"鸡尾酒会算法 "允许你在混乱的环境中找到结构。(即从鸡尾酒会的网状声音中识别出个别的声音和音乐)。
鸡尾酒会问题算法 Cocktail party problem algorithm
[W,s,v] = svd((repmat(sum(x.*x,1),size(x,1),1).*x)*x');
SVD: 奇异值分解(singular value decomposition)
Prototyping Tool: Matlab/Octave
每天学点算法
Given an array of time intervals (start, end) for classroom lectures (possibly overlapping), find the minimum number of rooms required. For example, given [(30, 75), (0, 50), (60, 150)], you should return 2.
给定课堂授课的时间间隔(开始、结束)数组(可能重叠),求所需的最小房间数。例如,给定[(30,75),(0,50),(60,150)],应该返回2。
参考:Snapchat Coding Interview Questions
LeetCode – Meeting Rooms II (Java)
我们编写minRooms(intervals)函数,根据时间间隔以二维数组的方式呈现,返回所需的最小房间数。
- 当一个新的会议开始时,我们需要一个额外的房间。
- 当一个会议结束时,我们不需要那个房间了优先考虑较小的开始或结束时间,如果开始时间和结束时间相等,结束时间优先。
minRooms = function(intervals){
const startingTimes = [];
const endingTimes = [];
for (let i = 0; i < intervals.length; i++){
const [startTime, endTime] = intervals[i];
startingTimes[i] = startTime;
endingTimes[i] = endTime;
}
startingTimes.sort((a, b) => a - b );
endingTimes.sort((a, b) => a - b );
// When a new meeting starts, we need and additional room.
// When a meeting ends, we dont need that room anymore prioritize the smaller starting or ending time
// if the start time and end time are equal, end time comes first
let sIdx = 0;
let eIdx = 0;
let maxRooms = 0;
let currRooms = 0;
while (sIdx < startingTimes.length || eIdx < endingTimes.length){
//dont need to traverse through the ending itmes if all the starting time rooms are used
if (sIdx >= startingTimes.length) break;
if (startingTimes[sIdx] < endingTimes[eIdx]) {
currRooms++;
sIdx++;
} else {
currRooms--;
eIdx;
}
maxRooms = Math.max(maxRooms, currRooms);
}
return maxRooms;
}
console.log(minRooms([[30, 75],[0,50],[60, 150]]))
其他值得阅读
7条非常规的编码建议
原文:7 Unconventional Pieces of Coding Advice
- 没有完美的编码方式,只有首选的编码方式。| There Is No Perfect Way To Code, Only the Preferred Way To Code
- 适应让简洁编码清晰 | Acclimation Made Simple Concise Coding Clear
- 优先选择Git注释,而不是代码注释或没有注释。 | Prefer Git Comments Over Code Comments or No Comments
- 代码的可维护性不在于它能持续多久,而在于它能多容易地被修改或删除。 | the Maintainability of Code Is Not How Long It Can Last, but How Easily It Can Be Changed or Removed
- 用独立依赖的方法设计软件。| Design Software Using an Independently Dependency Approach
- 预防不一定比修复好。 | Prevention Is Not Always Better Than Cure
在CSS中处理图片上的文字
原文: Handling Text Over Images in CSS
渐变叠加
当渐变下文字并不清晰时。利用改变渐变的高度可以帮助深色渐变覆盖更多的区域。
给.card__content元素加上min-height。 Flexbox来将内容推到底部。
.card__content {
position: absolute;
/* other styles (left, top, right, and padding) */
display: flex;
flex-direction: column;
justify-content: flex-end;
background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
}
/*Another solution*/
.card__content {
position: absolute;
padding-top: 60px;
background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
}
缓和渐变(Easing)
如果你仔细观察,会发现渐变结束的地方很明显,这就造成了一种叫做硬边的东西。为了让这个效果更好,我们可以将缓和概念应用到渐变中。这样一来,渐变就会显得更加自然,而且你也不会注意到它最后的硬边。
.card__content {
background-image: linear-gradient(
0deg,
hsla(0, 0%, 35.29%, 0) 0%,
hsla(0, 0%, 34.53%, 0.034375) 16.36%,
hsla(0, 0%, 32.42%, 0.125) 33.34%,
hsla(0, 0%, 29.18%, 0.253125) 50.1%,
hsla(0, 0%, 24.96%, 0.4) 65.75%,
hsla(0, 0%, 19.85%, 0.546875) 79.43%,
hsla(0, 0%, 13.95%, 0.675) 90.28%,
hsla(0, 0%, 7.32%, 0.765625) 97.43%,
hsla(0, 0%, 0%, 0.8) 100%
);
}
垂直渐变
background: linear-gradient(
to right,
hsl(0, 0%, 0%) 0%,
hsla(0, 0%, 0%, 0.964) 7.4%,
hsla(0, 0%, 0%, 0.918) 15.3%,
hsla(0, 0%, 0%, 0.862) 23.4%,
hsla(0, 0%, 0%, 0.799) 31.6%,
hsla(0, 0%, 0%, 0.73) 39.9%,
hsla(0, 0%, 0%, 0.655) 48.2%,
hsla(0, 0%, 0%, 0.577) 56.2%,
hsla(0, 0%, 0%, 0.497) 64%,
hsla(0, 0%, 0%, 0.417) 71.3%,
hsla(0, 0%, 0%, 0.337) 78.1%,
hsla(0, 0%, 0%, 0.259) 84.2%,
hsla(0, 0%, 0%, 0.186) 89.6%,
hsla(0, 0%, 0%, 0.117) 94.1%,
hsla(0, 0%, 0%, 0.054) 97.6%,
hsla(0, 0%, 0%, 0) 100%
);
混合纯色和渐变色
我是从Netflix网站了解到这个模式的。在非登录用户的主页上,有一个大背景图的标题。
<div class="hero">
<img src="cover.jpg" alt="" />
<div class="hero__content">
<h2>Unlimited movies, TV shows, and more.</h2>
<p>Watch anywhere. Cancel anytime.</p>
</div>
</div>
<style>
.hero:after {
content: "";
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
background-image: linear-gradient(
to top,
rgba(0, 0, 0, 0.8),
rgba(0, 0, 0, 0) 60%,
rgba(0, 0, 0, 0.8) 100%
);
}
</style>
如何给A.I.赋予意识
原文:How to Give A.I. a Pinch of Consciousness
世界上最重要的A.I.专家之一,魁北克人工智能研究所Mila的创始人Yoshua Bengio同样对A.I.中的意识非常着迷,他用开车的比喻来描述意识和无意识行为的切换。 "当你学习如何开车时,开始是由意识控制的,然后,经过一些练习,大部分工作都是在无意识层面上完成的,你可以在开车时进行对话,"他通过电子邮件解释道。
哲学家丹尼尔-丹尼特(Daniel Dennett)一生中大部分时间都在思考什么是意识,什么不是意识,他认为我们不会很快看到机器发展出这种意识水平--甚至在50年内也不会。他和其他人都指出,我们今天能够制造的A.I.s似乎没有半点我们认为对意识至关重要的反思性思维或意识。 不过,正是在寻找一个确实具备这些属性的系统时,神经科学和人工智能研究之间可能会发生深刻的交叉。目前,意识仍然是科学的一大谜团。没有人知道它到底和大脑中的什么活动联系在一起,尽管科学家们逐渐发现,某些神经连接似乎和它有关。一些研究人员发现,大脑活动中的振荡似乎与特定的意识状态有关--如果你愿意的话,这是清醒的信号。 牛津大学计算机科学研究助理卡米洛-米格尔-西诺雷利(Camilo Miguel Signorelli)建议,通过在机器中复制这种活动,我们或许可以让它体验到有意识的思想。 他提到了《Ex Machina》中机器人的液体 "wetware "大脑,这是一个基于凝胶的神经活动容器。"我必须摆脱电路,我需要一些能够在分子水平上进行排列和重新排列的东西"奥斯卡-艾萨克的角色解释说,他创造了一个有意识的机械人。 "在一个有意识的机器中错误地制造痛苦的风险是我们需要避免的。" "这将是一个理想的实验系统,"Signorelli说,因为一个流体的、高度可塑性的大脑可能会被配置成经历意识形成的神经振荡--类似于我们在人类大脑中看到的活动波。 必须说,这是高度推测性的。然而,它提出了一个问题,即意识(我们所经历的)是否可能需要完全不同的硬件才能在机器中产生。即使有一天我们真的成功地确认了意识在计算机中的存在,Signorelli也说,我们很可能对它没有真正的权力。 "可能我们会得到另一种动物,类似人类的意识,但我们无法控制这种意识。"他说。 正如一些人所认为的那样,这可能会使这样的人工智能变得危险和不可预测。但是,一个被证明无害的意识机器仍然可能引发伦理上的疑惑。如果它感到痛苦、绝望或可怕的混乱状态怎么办? 剑桥大学研究人类大脑活动和意识的博士生Andrea Luppi说:"在意识机器中错误地制造痛苦的风险是我们需要避免的"。 在我们真正需要努力解决这类问题之前,可能还需要很长一段时间。但人工智能研究正越来越多地借鉴神经科学和关于意识的想法,以追求更强大的系统。
一点收获
- Chrome长截图:打开开发者工具,Cmd + Shift + P 运行命令「Capture full size screenshot」