Pandas 中map, applymap and apply的区别

Summing up, apply works on a row / column basis of a DataFrame, applymap works element-wise on a DataFrame, and map works element-wise on a Series.

Read more   2018/11/16 posted in  Python

Objective vs. Cost vs. Loss vs. Error Function

The function we want to minimize or maximize is called the objective function, or criterion. When we are minimizing it, we may also call it the cost function, loss function, or error function - these terms are synonymous. The cost function is used more in optimization problem and loss function is used in parameter estimation.

Read more   2018/11/13 posted in  MachineLearning

将python生成的base64图片,在浏览器上展示出来

方便调试

<!DOCTYPE html>
<html>
  <head>
    <title>show base64 pic</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </head>
  <body>
    <div id='root'>
        <img src="data:image/png;base64,这里是base64的内容,替换掉即可(中文部分)" />
    </div>
  </body>
</html>
Read more   2018/10/23 posted in  Python

Isolation Forest

scikit-learn返回:是异常点(-1)或者不是异常点(1)

孤立森林-->查看数据页面,如上所示
原始数据的所有列,预测出来是否是异常值,也即是是否偏离(偏移即是-1),偏移度也就是decision_function算出来的值,返回样本的异常评分,值越小表示越有可能是异常样本
data,model.predict(X_train),model.decision_function(X_train)

df=pd.concat([pd.DataFrame(X_train),pd.Series(clf.predict(X_train)), pd.Series(clf.decision_function(X_train))], axis=1)

df.columns = ['a', 'b', 'c', 'd']
2018/10/18 posted in  MachineLearning

聚类算法评估指标

Not Given Label

1、Compactness(紧密性)(CP)

Read more   2018/10/16 posted in  MachineLearning