使用 Vue 创建 Web Component
准备
安装 vue 命令行工具:
> yarn global add @vue/cli
生成一个空白仓库:
> vue create json-viewer
可以使用的选项如下(参考, 根据自己的需要调整):
用树回归方法画股票趋势线
本篇的主题是分段线性拟合, 也叫回归树, 是一种集成算法, 它同时使用了决策和线性回归的原理, 其中有两点不太容易理解, 一个是决策树中熵的概念, 一个是线性拟合时求参数的公式为什么是由矩阵乘法实现的. 如需详解, 请见前篇:
画出股票的趋势线
我们常在股票节目里看到这样的趋势线:
常见的时间序列趋势判别算法
本文介绍常见的时间序列趋势判别算法:
- 多项式拟合(斜率)
- Mann-Kendall 趋势检验检验
- Cox-stuart 趋势检验
多项式拟合(最小二乘法)
基本原理
核心是使用最小二乘法见序列拟合成一条直线, 然后根据直线的斜率 k
判断序列的走势. 如果返回的是正数则正增长, 如果返回的是负数则为下降, 如果为 0 则表示没有趋势.
Monkey Patching in Go
本文是 Monkey Patching in Go 的阅读理解.
原文 Monkey Patching in Go
Many people think that monkey patching is something that is restricted to dynamic languages like Ruby and Python. That is not true however, as computers are just dumb machines and we can always make them do what we want! Let’s look at how Go functions work and how we can modify them at runtime. This article will use a lot of Intel assembly syntax, so I’m assuming you can read it already or are using a reference while reading.
python 元编程
本文讲述了 python 中 class 的一些细节. 包含:
- class 定义和 class 对象
- class 实例对象
__new__
函数和 __call__
函数
先从简单的开始, 比如以下代码:
python 的 metaclass 到底是什么
文章地址: https://stackoverflow.com/questions/100003/what-are-metaclasses-in-python?answertab=votes#tab-top
Classes as objects
Before understanding metaclasses, it helps to understand Python classes more deeply. Python has a very peculiar idea of what classes are, which it borrows from the Smalltalk language.
In most languages, classes are just pieces of code that describe how to produce an object. That is somewhat true in Python too:
>>> class ObjectCreator(object):
... pass
>>> my_object = ObjectCreator()
>>> print(my_object)
<__main__.ObjectCreator object at 0x8974f2c>
共计 72 篇文章,9 页。