建模调参

通过前面的 EDA特征工程探索,想必应该已经对数据有了比较深入的了解,那么接下来就是利用之前所学来建模看看实战效果了。因为之前是系统性学习,所以并不一定所有的技术都要用到,而且建模应该是个结合对数据已有了解的基础上进行重新思考的过程。

本文分为以下几个部分:

  • 重新思考梳理 Pipeline 流程
  • 建模
  • 调参

More

特征工程

常听一句话说 “你还能玩儿出花来”,我觉得特征工程就是这么个把那些看上去普普通通的 “数据” 玩儿出花的过程。如果用 DIKW 模型(Data Information Knowledge Wisdom)来理解,Data 显然就是原始的一个个数据值,Information 就是对数据进行分析、处理后得到的具有一定意义的东西。

严格的定义如下:特征工程是对原始数据进行一系列工程处理,将其提炼为特征根,作为模型的输入。它旨在去除原数据中的杂质和冗余,使得模型与预测值之间能够以此建立联系。

More

EDA

探索性数据分析 EDA(Exploratory Data Analysis)是数据分析和挖掘的第一步,主要是对数据集进行了解,包括基本情况、特征情况、特征间关系等等,为进一步的分析和挖掘提供信息。

一个完整的 EDA 过程一般大致包括四步:

  • 问题定义:问题定义涉及的主要任务是定义分析的主要目标,定义主要的可交付成果,概述主要角色和职责,获取数据的当前状态,定义时间表以及执行成本/收益分析。
  • 数据准备:包括数据源定义、数据 schema 定义、数据特征了解、数据清理、数据转换、数据分割等。
  • 数据分析:这是处理描述性统计信息和数据分析的最关键步骤之一。 主要任务包括汇总数据,发现数据之间隐藏的关联和关系,开发预测模型,评估模型以及计算精度。
  • 结果展示:以图表、摘要、地图和图表的形式将数据集呈现给目标受众。

More

Find First and Last Position of Element in Sorted Array (LeetCode 34)

Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.

Your algorithm’s runtime complexity must be in the order of O(log n).

If the target is not found in the array, return [-1, -1].

Example 1:

1
2
Input: nums = [5,7,7,8,8,10], target = 8
Output: [3,4]

Example 2:

1
2
Input: nums = [5,7,7,8,8,10], target = 6
Output: [-1,-1]

Constraints:

  • 0 <= nums.length <= 10^5
  • -10^9 <= nums[i] <= 10^9
  • nums is a non decreasing array.
  • -10^9 <= target <= 10^9

More

Search in Rotated Sorted Array (LeetCode 33, 81, 153)

Given an integer array nums sorted in ascending order, and an integer target.

Suppose that nums is rotated at some pivot unknown to you beforehand (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).

You should search for target in nums and if you found return its index, otherwise return -1.

Example 1:

1
2
Input: nums = [4,5,6,7,0,1,2], target = 0
Output: 4

Example 2:

1
2
Input: nums = [4,5,6,7,0,1,2], target = 3
Output: -1

Example 3:

1
2
Input: nums = [1], target = 0
Output: -1

Constraints:

  • 1 <= nums.length <= 5000
  • -10^4 <= nums[i] <= 10^4
  • All values of nums are unique.
  • nums is guranteed to be rotated at some pivot.
  • -10^4 <= target <= 10^4

More