xgboost.XGBClassifier参数
打*参数为重要 XGBClassifier( 1.silent=0#设置成1则没有运行信息输出,默认为0.是否在运行时打印消息 2.*learning_rate=0.1#学习率,过大收敛不了,小了收敛慢 3.*min_child_weight=1#叶子里面h的和,h就是二阶导不清楚的看看xgboost原理,该参数越小越容易过拟合 4.*max_depth=6, # 构建树的深度,越大越容易过拟合,可以用CV函数来进行调优 5.gamma=0, # 树的叶子节点上作进一步分区所需的最小损失减少,
LGBMClassifier参数
1.boosting_type=‘gbdt’# 提升树的类型 gbdt,dart,goss,rf 2.num_leavel=32#树的最大叶子数,对比xgboost一般为2^(max_depth) 3.max_depth=-1#最大树的深度 4.learning_rate#学习率 5.n_estimators=10: 拟合的树的棵树,相当于训练轮数 6.subsample=1.0: 训练样本采样率 行 7.colsample_bytree=1.0: 训练特征采样率 列 8.subsample_
pandas的groupby
作用: groupby操作的是所有操作标签相同的数 比如data.groupby(‘col1’)操作的是所有col1标签相同的行他们列相加 例如下面一个dataframe A B C
0 a 2 102
1 b 8 98
2 a 1 107
3 c 4 104
4 a 3 115
5 c 2 87
6 b 5 92
7 c 9 123
df.groupby('A').mean()
A B C
分享一波我觉得很好的关于ml和dl的公众号
干货较多型: 1.Paperweekly:重磅推荐,更新量很足都是目前前沿的ai论文以及解读,并且附有原文链接,省去了查找的麻烦 2.AI研习社:里面会有很多基础性的python操作,会有常见的model的讲解 3.AI有道:里面有干货资源,但是平时推文营养不怎么够 了解拓展型: 1.量子位 2.AI前线
将一个series插入到一个dataframe任一一列中
例如我们将series1插入到df中 #我们从一个dataframe中选取一列series1.
series1=data.pop('day')
#为df1添加一个列,第一个0我们可以改变选择你想插入的位置,第二个可以选择你想要的名字
df.insert(0,'series1',series1)
#对这一列赋值
#df['series1']=series1
Highest Price in Supply Chain (25)
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Starting from one root supplier, everyone on the chain buys products from one’s supplier in a pri
对dataframe的行和列进行遍历和修改
首先先定一个这样的字典,然后我们用不同的方法对其遍历和修改 字典df df=pd.DataFrame({"A":[1,2,3,4],"B":[5,6,7,8],"C":[1,1,1,1]})
A B C
0 1 5 1
1 2 6 1
2 3 7 1
3 4 8 1
i.遍历列 1.ix函数(df.ix[条件,操作区域]) df.ix[df.A>1,'B']=-1
df
A B C
0 1 5 1
1 2 -1 1
2 3 -1 1
Consecutive Factors (20)
题目描述 Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 356*7, where 5, 6, and 7 are the three consecutive numbers. Now given any positive N, you are supposed to find the m
intellij idea 搭环境
两年没搭环境了,最近工作需要,搭建了一次。遇到不少问题,记录于此 装jdk 装maven 装intellij idea社区版 先安装git,然后在intellij 中 file -> setting配置git路径 安装scala,注意scala安装目录不能有空格。例如“Program Files”中有空格,环境变量会识别不出 在intellij plugins 里安装Scala+Plugin+for+IntelliJ+IDEA,然后设置 scala sdk mvn -v,刚开始还没生效,排查了
presto UI 分析及相关源码分析
CLUSTER OVERVIEW RESERVED MEMORY QUERY DETAILS Query overview query Live Plan stage performance 总结 CLUSTER OVERVIEW 访问coordinator 的 http://IP:PORT,首先呈现的是 cluster overview 九个参数窗口,唯独 “ RESERVED MEMORY ” 不太好理解,presto 相关文档又没有解释。 而且容易和presto的配置“resources
vnc-server 安装和配置
安装 安装命令 在线安装,“-y” 表示 有交互时,都选“yes” yum -y install tigervnc-server 更改配置 cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service 复制后修改 #/root/.vnc 而不是 /home/root/.vnc
#root 用户比较特别,不带 home/
[Service]
Type=forking
# Clean any
Guava Cache 研究
,Guava Cache其核心数据结构大体上和ConcurrentHashMap一致,具体细节上会有些区别。功能上,ConcurrentMap会一直保存所有添加的元素,直到显式地移除.相对地,Guava Cache为了限制内存占用,通常都设定为自动回收元素.在某些场景下,尽管它不回收元素,也是很有用的,因为它会自动加载缓存. class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> 子类 Lo
Spark Executor 执行 rdd task
##本文探究executor 执行rdd 时的回溯实现 处理 submitJob提交的job private[scheduler] def handleJobSubmitted(jobId: Int,
finalRDD: RDD[_],
func: (TaskContext, Iterator[_]) => _,
partitions: Array[Int],
callSite: CallSite,
listener: JobLi
maven 中,使用shadedClassifierName配置项,解决jar自带版本号的问题
增加以下两行配置 <shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>with-spark-${spark.internal.version}</shadedClassifierName>
就可以使得编译的jar包带上指定的后缀 maven <plugin>
<groupId>org.apache.maven.plugins</groupId>
Spark 各种配置项
/bin/spark-shell --master yarn --deploy-mode client
/bin/spark-shell --master yarn --deploy-mode cluster
There are two deploy modes that can be used to launch Spark applications on YARN. In cluster mode, the Spark driver runs inside an application
hadoop 集群遇到的问题汇总
有时候报错会误导问题的定位和排查,比如下面这一款 org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /user/root/.sparkStaging/application_1539063128463_0573/__spark_libs__2844575839698714585.zip could only be replicated to 0 nodes instead of minReplication (=1
spark-sql剖析
SQL语句首先被Parser模块解析成Unresolved Logical Plan; Unresolved Logical Plan通过Analyzer模块借助于Catalog中的表信息解析为Logical Plan; Optimizer再通过各种基于规则的优化策略进行深入优化,得到Optimized Logical Plan; 优化后的逻辑执行计划依然是逻辑的,并不能被Spark系统理解,此时需要将此逻辑执行计划转换为Physical Plan。 源码探究 sql 入口解析 /**
Spark job 的触发
判断是RDD action的操作的一个标志是 其函数实现里得有 sc.runJob
RDD 是怎么触发job的 以 rdd.count 为例 RDD.scala /**
* Return the number of elements in the RDD.
*/
def count(): Long = sc.runJob(this, Utils.getIteratorSize _).sum
SparkContext.scala /**
* Run a job on a
Spark Basic Concepts
Datasets and DataFrames A Dataset is a distributed collection of data. Dataset is a new interface added in Spark 1.6 that provides the benefits of RDDs (strong typing, ability to use powerful lambda functions) with the benefits of Spark SQL’s optimi
Spark job 提交
Driver 侧在任务提交的时候要完成以下几个工作 RDD依赖分析,以生成DAG 根据DAG 将job 分割成多个 stage stage 一经确认,即生成相应的 task,将生成的task 分发到 Executor 执行 提交的实现入口在SparkContext.scala /**
* Run a job on all partitions in an RDD and return the results in an array.
*
* @param rdd target
周排行