Datawhale AI夏令營-基于帶貨視頻評論的用戶洞察挑戰賽

一.賽事目標

基于星火大模型Spark 4.0 Ultra,對視頻和評論的數據進行商品識別,情感分析,歸類分析,最終為帶貨效果進行評價。并通過優化模型來提高評價準確度

二.賽事環境

1.基礎平臺:星火大模型Spark 4.0 Ultra

2.賽事數據:視頻,視頻彈窗評論

包含85條脫敏后的帶貨視頻數據及6477條評論文本數據?

包括少量有人工標注結果的訓練集(僅包含商品識別和情感分析的標注結果)以及未標注的測試集。

  • 帶貨視頻內容文本信息的數據格式
序號變量名稱變量格式解釋
1video_idstring視頻id
2video_descstring視頻描述
3video_tagsstring視頻標簽
4product_namestring推廣商品名稱
  • 評論區文本信息的數據格式
序號變量名稱變量格式解釋
1video_idstring視頻id
2comment_idstring評論id
3comment_textstring評論文本
4sentiment_categoryint關于商品的情感傾向分類
5user_scenarioint是否與用戶場景有關,0表示否,1表示是
6user_questionint是否與用戶疑問有關,0表示否,1表示是
7user_suggestionint是否與用戶建議有關,0表示否,1表示是
8positive_cluster_themestring按正面傾向聚類的類簇主題詞
9negative_cluster_themestring按負面傾向聚類的類簇主題詞
10scenario_cluster_themestring按用戶場景聚類的類簇主題詞
11question_cluster_themestring按用戶疑問聚類的類簇主題詞
12suggestion_cluster_themestring按用戶建議聚類的類簇主題詞

?三.賽事任務

  • 【商品識別】從視頻的數據里精準識別推廣商品;

  • 【情感分析】對評論文本進行多維度情感分析,涵蓋維度見數據說明;

  • 【評論聚類】按商品對歸屬指定維度的評論進行聚類,并提煉類簇總結詞。

四.賽事目標

基于給定的賽事步驟

1.加載數據

import pandas as pd
video_data = pd.read_csv("origin_videos_data.csv")
comments_data = pd.read_csv("origin_comments_data.csv")

2.取樣表條數10條

video_data.sample(10)

?3.提取表頭

comments_data.head()

4.將視頻數據的兩個字段合并到一個字段,用來提取商品信息

video_data["text"] = video_data["video_desc"].fillna("") + " " + video_data["video_tags"].fillna("")

?5.加載分詞器,情感分析,聚類分析等工具包

import jieba
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import SGDClassifier
from sklearn.svm import LinearSVC
from sklearn.cluster import KMeans
from sklearn.pipeline import make_pipeline

6.進行分詞,從視頻數據里獲取到商品名product_name的集合

product_name_predictor = make_pipeline(TfidfVectorizer(tokenizer=jieba.lcut, max_features=50), SGDClassifier()
)
product_name_predictor.fit(video_data[~video_data["product_name"].isnull()]["text"],video_data[~video_data["product_name"].isnull()]["product_name"],
)
video_data["product_name"] = product_name_predictor.predict(video_data["text"])

max_features=50:表示在轉換過程中只保留前50個最常見的詞匯特征。這有助于減少特征的維度,并提高計算效率。?

7.加載評論數據

comments_data.columns

?8.對評論數據進行情感分析

for col in ['sentiment_category','user_scenario', 'user_question', 'user_suggestion']:predictor = make_pipeline(TfidfVectorizer(tokenizer=jieba.lcut), SGDClassifier())predictor.fit(comments_data[~comments_data[col].isnull()]["comment_text"],comments_data[~comments_data[col].isnull()][col],)comments_data[col] = predictor.predict(comments_data["comment_text"])

9.聚類提取關鍵詞數量

top_n_words = 20

top_n_words 的意義
主題表示:top_n_words 決定了你從每個聚類中提取多少個關鍵詞來代表該聚類的主題。例如,如果 top_n_words=20,那么每個聚類主題將包含 20 個關鍵詞,這些關鍵詞是根據它們在聚類中心的貢獻度排名選出的。

對理解聚類的影響:選擇不同數量的關鍵詞會影響你對聚類主題的理解。更多的關鍵詞可以提供更全面的主題描述,但也可能引入噪聲;較少的關鍵詞則可能會導致主題描述不夠完整。

總結來說,top_n_words 是一個關鍵的參數,它幫助定義在每個聚類中提取的最重要詞匯的數量,進而影響對聚類主題的理解。

?10.情感分析-1

kmeans_predictor = make_pipeline(TfidfVectorizer(tokenizer=jieba.lcut), KMeans(n_clusters=5)
)kmeans_predictor.fit(comments_data[comments_data["sentiment_category"].isin([1, 3])]["comment_text"])
kmeans_cluster_label = kmeans_predictor.predict(comments_data[comments_data["sentiment_category"].isin([1, 3])]["comment_text"])kmeans_top_word = []
tfidf_vectorizer = kmeans_predictor.named_steps['tfidfvectorizer']
kmeans_model = kmeans_predictor.named_steps['kmeans']
feature_names = tfidf_vectorizer.get_feature_names_out()
cluster_centers = kmeans_model.cluster_centers_
for i in range(kmeans_model.n_clusters):top_feature_indices = cluster_centers[i].argsort()[::-1]top_word = ' '.join([feature_names[idx] for idx in top_feature_indices[:top_n_words]])kmeans_top_word.append(top_word)comments_data.loc[comments_data["sentiment_category"].isin([1, 3]), "positive_cluster_theme"] = [kmeans_top_word[x] for x in kmeans_cluster_label]

?11.情感分析-1

kmeans_predictor = make_pipeline(TfidfVectorizer(tokenizer=jieba.lcut), KMeans(n_clusters=5)
)kmeans_predictor.fit(comments_data[comments_data["sentiment_category"].isin([2, 3])]["comment_text"])
kmeans_cluster_label = kmeans_predictor.predict(comments_data[comments_data["sentiment_category"].isin([2, 3])]["comment_text"])kmeans_top_word = []
tfidf_vectorizer = kmeans_predictor.named_steps['tfidfvectorizer']
kmeans_model = kmeans_predictor.named_steps['kmeans']
feature_names = tfidf_vectorizer.get_feature_names_out()
cluster_centers = kmeans_model.cluster_centers_
for i in range(kmeans_model.n_clusters):top_feature_indices = cluster_centers[i].argsort()[::-1]top_word = ' '.join([feature_names[idx] for idx in top_feature_indices[:top_n_words]])kmeans_top_word.append(top_word)comments_data.loc[comments_data["sentiment_category"].isin([2, 3]), "negative_cluster_theme"] = [kmeans_top_word[x] for x in kmeans_cluster_label]

?14.情感分析-3

kmeans_predictor = make_pipeline(TfidfVectorizer(tokenizer=jieba.lcut), KMeans(n_clusters=5)
)kmeans_predictor.fit(comments_data[comments_data["user_scenario"].isin([1])]["comment_text"])
kmeans_cluster_label = kmeans_predictor.predict(comments_data[comments_data["user_scenario"].isin([1])]["comment_text"])kmeans_top_word = []
tfidf_vectorizer = kmeans_predictor.named_steps['tfidfvectorizer']
kmeans_model = kmeans_predictor.named_steps['kmeans']
feature_names = tfidf_vectorizer.get_feature_names_out()
cluster_centers = kmeans_model.cluster_centers_
for i in range(kmeans_model.n_clusters):top_feature_indices = cluster_centers[i].argsort()[::-1]top_word = ' '.join([feature_names[idx] for idx in top_feature_indices[:top_n_words]])kmeans_top_word.append(top_word)comments_data.loc[comments_data["user_scenario"].isin([1]), "scenario_cluster_theme"] = [kmeans_top_word[x] for x in kmeans_cluster_label]

15.情感分析-4

kmeans_predictor = make_pipeline(TfidfVectorizer(tokenizer=jieba.lcut), KMeans(n_clusters=5)
)kmeans_predictor.fit(comments_data[comments_data["user_question"].isin([1])]["comment_text"])
kmeans_cluster_label = kmeans_predictor.predict(comments_data[comments_data["user_question"].isin([1])]["comment_text"])kmeans_top_word = []
tfidf_vectorizer = kmeans_predictor.named_steps['tfidfvectorizer']
kmeans_model = kmeans_predictor.named_steps['kmeans']
feature_names = tfidf_vectorizer.get_feature_names_out()
cluster_centers = kmeans_model.cluster_centers_
for i in range(kmeans_model.n_clusters):top_feature_indices = cluster_centers[i].argsort()[::-1]top_word = ' '.join([feature_names[idx] for idx in top_feature_indices[:top_n_words]])kmeans_top_word.append(top_word)comments_data.loc[comments_data["user_question"].isin([1]), "question_cluster_theme"] = [kmeans_top_word[x] for x in kmeans_cluster_label]

16.情感分析-5

kmeans_predictor = make_pipeline(TfidfVectorizer(tokenizer=jieba.lcut), KMeans(n_clusters=5)
)kmeans_predictor.fit(comments_data[comments_data["user_suggestion"].isin([1])]["comment_text"])
kmeans_cluster_label = kmeans_predictor.predict(comments_data[comments_data["user_suggestion"].isin([1])]["comment_text"])kmeans_top_word = []
tfidf_vectorizer = kmeans_predictor.named_steps['tfidfvectorizer']
kmeans_model = kmeans_predictor.named_steps['kmeans']
feature_names = tfidf_vectorizer.get_feature_names_out()
cluster_centers = kmeans_model.cluster_centers_
for i in range(kmeans_model.n_clusters):top_feature_indices = cluster_centers[i].argsort()[::-1]top_word = ' '.join([feature_names[idx] for idx in top_feature_indices[:top_n_words]])kmeans_top_word.append(top_word)comments_data.loc[comments_data["user_suggestion"].isin([1]), "suggestion_cluster_theme"] = [kmeans_top_word[x] for x in kmeans_cluster_label]

17.創建目錄

mkdir submit

18.打壓縮包

video_data[["video_id", "product_name"]].to_csv("submit/submit_videos.csv", index=None)
comments_data[['video_id', 'comment_id', 'sentiment_category','user_scenario', 'user_question', 'user_suggestion','positive_cluster_theme', 'negative_cluster_theme','scenario_cluster_theme', 'question_cluster_theme','suggestion_cluster_theme']].to_csv("submit/submit_comments.csv", index=None)

五.操作步驟

為了提高賽事提高分數,本文從一下幾個方面進行微調

1.修改n_clusters=5,默認抽取10個視頻樣本

結果:

分數詳情?

2.20個關鍵字,仍然保持n_clusters=5

最終結果

分數詳情

3.增加樣本,選擇20個樣本,其他保持和2一致

分數更低,因為視頻數據有一些是空的,沒有手工標注的。可能手工標注之后會提高

?總結:

賽事最高微調到228份多點,后面可以再手工標注后優化

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/914431.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/914431.shtml
英文地址,請注明出處:http://en.pswp.cn/news/914431.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

如何基于FFMPEG 實現視頻推拉流

文章目錄 前言環境準備為什么選擇 FFmpeg什么是nginx 1.7.11.3 GryphonNginx的conf配置啟動nginx推流命令接收視頻流Untiy播放視頻流最后前言 我們經常會有在電腦上實現推拉流的需求,Unity 和Unreal 都提供了基于WebRTC 的視頻流方案,效果還不錯,但是當我們需要推拉整個電腦…

飛算JavaAI:從情緒價值到代碼革命,智能合并項目與定制化開發新范式

目錄一、飛算 JavaAI 是什么?二、飛算JavaAI:安裝登錄2.1 IDEA插件市場安裝(推薦)2.2 離線安裝包三、飛算JavaAI核心功能:一鍵生成完整工程代碼功能背景3.1 理解需求3.2 設計接口3.3 表結構自動設計3.4 處理邏輯&#…

Python 基礎語法與數據類型(十一) - 類 (class) 與對象 (實例)

文章目錄1. 什么是類 (Class)?1.1 定義一個類2. 什么是對象 (Object) 或實例 (Instance)?2.1 創建對象(實例化)3. 訪問屬性和調用方法4. 類屬性 vs 實例屬性5. self 的重要性總結練習題練習題答案前幾篇文章我們學習了變量、數據類…

精準數據檢索+數據飛輪自驅優化,彩訊AI知識庫助力企業知識賦能和效率創新

近兩年,人工智能技術的精細化發展,讓知識庫概念重新成為“熱門詞匯”,騰訊ima等智能工作臺產品為個人用戶打造專屬知識庫,而面向B端市場,企業AI知識庫也逐步成為企業集中存儲與管理核心文檔、數據、經驗和流程的知識中…

打破空間邊界!Nas-Cab用模塊化設計重構個人存儲邏輯

文章目錄前言1. Windows安裝Nas-Cab2. 本地局域網連接Nas-Cab3. 安裝Cpolar內網穿透4. 固定Nas-Cab 公網地址"數據管理不該受制于硬件形態或地理邊界。這個開源方案證明:當功能模塊化且可擴展時,私有云可以像水一樣滲透進所有設備——現在就去Git倉…

Sigma-Aldrich細胞培養基礎知識:細胞培養的安全注意事項

細胞培養實驗室風險評估風險評估的主要目的是防止人員受傷,保護財產,并避免對個人和環境的傷害。在許多國家,法律要求進行風險評估。例如,英國的《英國職業健康與安全法案(1974年)》就是一個例子。歐洲共同…

Imx6ull用網線與電腦連接

理解工作方式沒有路由器時,可以使用,只要保持虛擬機的兩個網卡一個與電腦在同一網,一個與板子在同一網段(保持通信)就可以從虛擬機往板子下載第一步:查看電腦連接的網絡這一步是在找到主機ip地址這兩步在其他同類教程里一樣的第二步:設置以太…

力扣454.四數相加Ⅱ

給你四個整數數組 nums1、nums2、nums3 和 nums4 &#xff0c;數組長度都是 n &#xff0c;請你計算有多少個元組 (i, j, k, l) 能滿足&#xff1a;0 < i, j, k, l < nnums1[i] nums2[j] nums3[k] nums4[l] 0示例 1&#xff1a;輸入&#xff1a;nums1 [1,2], nums2 …

Joplin:一款免費開源、功能強大且注重隱私的筆記軟件

Joplin 是一款免費開源、功能強大且注重隱私的筆記和待辦事項應用程序&#xff0c;它的設計目標是成為 Evernote 等流行筆記應用的強大替代品&#xff0c;尤其適合重視數據所有權和隱私的用戶。 功能特性 Joplin 的核心定位與優勢如下&#xff1a; 完全開源&#xff1a;代碼公…

滲透前四天總結

目錄 一.DNS DNS 基本概述 DNS解析過程 二.HTTPS TLS握手過程 RSA加密 對稱加密&#xff1a; 非對稱加密&#xff1a; RSA加密過程 三.使用xdebug調試php 四.信息收集 一.DNS DNS 基本概述 DNS&#xff1a;域名系統(DomainNameSystem)因特網的一項核心服務&#xf…

Python----NLP自然語言處理(中文分詞器--jieba分詞器)

一、介紹文本語料在輸送給NLP模型前&#xff0c;需要一系列的預處理工作&#xff0c;才能符合模型輸入的要求。對于NLP來說&#xff0c;他學習一篇人類書寫的文章不是整體的來學習&#xff0c;而是一個詞一個詞的來學習。所以文本預處理的第一個步驟就是對文本進行分詞處理。&a…

深入了解linux系統—— 進程信號的保存

信號 信號&#xff0c;什么是信號&#xff1f; 在現實生活中&#xff0c;鬧鐘&#xff0c;紅綠燈&#xff0c;電話鈴聲等等&#xff1b;這些都是現實生活中的信號&#xff0c;當鬧鐘想起時&#xff0c;我就要起床&#xff1b;當電話鈴聲想起時&#xff0c;我就知道有人給我打電…

Redis 事務錯誤處理機制與開發應對策略

&#x1f4d8; Redis 事務錯誤處理機制與開發應對策略一、Redis 事務基礎回顧 Redis 中的事務由以下三組命令構成&#xff1a;命令作用說明MULTI開始一個事務&#xff0c;進入命令入隊模式命令集所有后續命令不會立即執行&#xff0c;而是入隊等待提交EXEC提交事務&#xff0c;…

信息學奧賽一本通 1549:最大數 | 洛谷 P1198 [JSOI2008] 最大數

【題目鏈接】 ybt 1549&#xff1a;最大數 洛谷 P1198 [JSOI2008] 最大數 【題目考點】 1. 線段樹&#xff1a;單點修改 區間查詢 知識點講解見&#xff1a;洛谷 P3374 【模板】樹狀數組 1&#xff08;線段樹解法&#xff09; 【解題思路】 本題為設線段樹維護區間最值&a…

【STM32】什么在使能寄存器或外設之前必須先打開時鐘?

這篇文章解釋一個非常基礎但是重要的問題&#xff1a; 為什么在使能寄存器或外設之前必須先打開時鐘&#xff1f; 我們會發現&#xff0c;如果不開時鐘就訪問寄存器 ? 會“寫不進去”或“讀取錯誤”。 因此&#xff0c;我們在寫代碼時&#xff0c;總是需要 先開時鐘&#xff0…

Go·并發處理http請求實現

一、Goroutine介紹 基本原理 goroutine 是 Go 運行時(Runtime)管理的??用戶態線程。與線程相比,其初始棧空間僅約 2KB,創建和切換的開銷更低,能夠同時運行大量并發任務。 創建goroutine的方法非常簡單,在將要調用的函數前加入go關鍵字即可。 func hello() {fmt.Pri…

USB一線連多屏?Display Link技術深度解析

DisplayLink 技術是一種基于USB接口的顯示輸出解決方案&#xff0c;通常用于通過USB端口連接多個顯示器&#xff0c;尤其在筆記本電腦、平板電腦和臺式機上&#xff0c;能夠顯著擴展顯示屏的數量和分辨率。它的核心技術原理是通過壓縮和傳輸圖形數據&#xff0c;將視頻信號通過…

AI 臨床醫學課題【總結】

最近參與了幾個臨床醫學課題,總結一下如何跨界結合 1: 確定研究的方向: 這個是決定文章的核心 研究方向的時候,就要確定要投的期刊,平時看論文的時候要把一些常用的術語記錄下來, 投的期刊,研究內容,方法記錄一下。 2: 研究團隊團隊搭建(負責人:負責讀論文,研究點…

PostgreSQL HOT (Heap Only Tuple) 更新機制詳解

PostgreSQL HOT (Heap Only Tuple) 更新機制詳解在PostgreSQL中&#xff0c;為了提高更新操作的性能并減少存儲空間的浪費&#xff0c;引入了一種稱為HOT (Heap Only Tuple) 的優化技術。HOT更新允許在相同的數據頁內進行行的更新操作&#xff0c;而不需要創建一個新的物理行版…

macos安裝iper3

brew install iperf3Running brew update --auto-update...安裝homebrew&#xff0c;長久沒用使用更新失效了。只好重新安裝 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"破案了 原來是需要海外網了。。。。 b…