第一週學習報告
阿新 • • 發佈:2020-07-12
本週完成工作
1、進行調研,完善專案方案;
2、攥寫可行性報告;
3、完成大致系統結構框圖。
本週進行的學習
1、HTML5的相關學習
初步學習了html5的一些知識,包括常用的標籤以及相關屬性,圖片的引入,連結的插入等,還學習了層疊樣式表的相關語法,對自己的html頁面進行排版與美化。
需要注意的是,html會忽略標籤中的連續的空白(包括空格、換行以及製表符),如果想要保持原有的文字格式,需要使用預格式文字標籤pre。
<!DOCTYPE html> <html lang="en"> <!--This is my html_learning's first step--> <head> <meta charset="UTF-8"> <title>QQ小介的html測試介面</title> </head> <!--標題的學習--> <h1 style="text-align:center">TEST PAGE</h1> <!--影象的學習--> <img src="1.jpg" width="364" height="209"> <hr /> <!--段落的學習--> <P>This is a picture in the same directory.<br />This is a new line but not a new paragraph.</P> <p style="font-family:fangsong;font-size:20px;color:purple">本行文字是<sup>仿宋</sup>,字號<sup>20</sup>,紫色</p> <p>本行是一行平庸的文字</p> <!--預文字的學習--> <pre style="background-color:green;font-size:20px"> 預文字標籤裡的縮排保持不變! <big>春曉</big> 春眠不覺曉, 處處聞啼鳥。 夜來風雨聲, 花落知多少。 </pre> <pre> if __name__ == "__main__": print("Hello world") </pre> <body style="background-color:yellow"> </body> </html>
2、機器學習之聚類
此處我使用的是sklearn庫的DBSCAN演算法對上網時長進行聚類分析,首先對資料文字進行處理,得到資料集;
import numpy as np import sklearn.cluster as skc from sklearn import metrics import matplotlib.pyplot as plt mac2id = dict() onlinetimes = [] f = open('test.txt') for line in f: mac = line.split(',')[2] onlinetimes = int(line.split(',')[6]) strattime = int(line.split(',')[4].split(' ')[1].split(':')[0]) if mac not in mac2id: mac2id[mac] = len(onlinetime) onlinetimes.append((strattime, onlinetime)) else: onlinetimes[mac2id[mac]] = [(strattime, onlinetime)] real_X = np.array(onlinetimes).reshape((-1, 2))
接著呼叫DBSCAN演算法對得到的資料集進行處理,並列印結果。
X = real_X[:, 0:1] db = skc.DBSCAN(eps=0.01, min_samples=20).fit(x) labels = db.labels_ print(labels) raito = len(labels[lable[:] == -1]) / len(labels) print("噪聲資料的比例:", raito) n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0) print(n_clusters_) print(metrics.silhouette_score(X, labels))