1.A——leetcode练习题
题目概述:
Determine whether an integer is a palindrome(回文数). An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
Example 3:
Input: 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome.
Follow up:Coud you solve it without converting the integer to a string?
自己尝试了一下用Python列表处理这道题:
class Solution:
def isPalindrome(self, x):
if int(x) < 0: #根据题目要求,率先判断输入值是否小于0
return False
else:
n = str(int(x)) #转换成字符串
List1 = list(n) #转换成列表
List1.reverse() #列表反转
List2 = list(n) #保存初始值
if List1 == List2: #判断反转前与反转后是否相等
return True
else:
return False
总结:
参考了别人的解题思路,发现这种写法不是最好的,最好的应该是直接处理字符串,可将末尾的判断替换成——
y = str(x)[::-1]
if y == str(x):
return True
else:
return False
这样跳过了列表处理,做法更加简单。
2.R——粗评技术文章-大数据相关
title:A greedy feature selection algorithm for Big Data of high dimensionality(高维大数据的贪婪特征算法)
原文地址:https://link.springer.com/article/10.1007%2Fs10994-018-5748-7
本文详细介绍了一种针对高维大数据的并行前后剪枝的特征选择算法(PFBP),这种算法相比较于传统数据处理,优越在只依赖分区本地的计算,最小化通信成本,从而实现计算的大规模并行化。而且数据量增多时,降低维数有利于处理密集型数据。
上学期利用Python实践过knn算法,但这种算法处理多维数据效率很低,且不够精准,于是这次找了这篇讲述高维数据处理的文章。时间有限,这一周只来得及研究理论,实践部分留待日后发掘。
3.S——学习到的技术技巧
①学习knn算法接触到了matplotlib这个可以用在数据可视化的第三方库,个人感觉十分好用,尤其是处理二维数据时,能快速看到数据的密集分布情况,有助于后期构建分类器。
②以前不知道归一化函数该怎么用、如何用,后来通过实践才明白,对于数值相差过大的两组或多组数据,必须通过归一化放缩到相同比例再进行计算,结果才能更准确。
4.T——分享的技术文章
上学期学习数据可视化的时候在网上找到一个很清楚的matplotlib的实战教程,链接如下:
https://blog.youkuaiyun.com/ScarlettYellow/article/details/80458797
现在已经不用matplotlib了,此条留待日后温习。