BBC纪录片《数学的故事》(附网盘资源)

好久没更新了,先和大家道个歉。

今天给大家安利一部非常棒的BBC纪录片《数学的故事》(The Story of Math),主讲人是牛津大学的一名数学教授,该纪录片以旅游的方式,带你走遍与数学有关的故事的发生地,在轻松悏意的氛围中了解数学的去世以及数学家深邃的思想。

该纪录片讲述的内容贯穿的整个数学史,从古代到现代,是一部了解数学非常好的纪录片,真的值得看一看,虽然年代稍微有点远,但毕竟是BBC的纪录片,质量还是很高的,具体有多好看就请大家亲自去体会啦!

资源链接:链接:https://pan.baidu.com/s/1R2qHeb9_8x37t-tPWxQ5lg 
提取码:1234 
 

以下是使用Python对BBC新闻进行分类的示例代码: 1. 安装必要的库 ```python !pip install pandas nltk sklearn ``` 2. 导入库 ```python import pandas as pd import nltk from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_selection import train_test_split from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import accuracy_score ``` 3. 加载数据 ```python data = pd.read_csv('bbc_news.csv') ``` 4. 创建停用词列表 ```python stop_words = stopwords.words('english') ``` 5. 创建词形还原器 ```python lemmatizer = WordNetLemmatizer() ``` 6. 对文本进行预处理 ```python def preprocess_text(text): # 将文本转换为小写 text = text.lower() # 去除标点符号 text = ''.join([char for char in text if char.isalpha() or char == ' ']) # 分词 tokens = nltk.word_tokenize(text) # 去除停用词 tokens = [token for token in tokens if token not in stop_words] # 词形还原 tokens = [lemmatizer.lemmatize(token) for token in tokens] # 将词列表转换为字符串 preprocessed_text = ' '.join(tokens) return preprocessed_text data['text'] = data['text'].apply(preprocess_text) ``` 7. 将文本转换为TF-IDF向量 ```python tfidf_vectorizer = TfidfVectorizer() tfidf = tfidf_vectorizer.fit_transform(data['text']) ``` 8. 将数据集分成训练集和测试集 ```python X_train, X_test, y_train, y_test = train_test_split(tfidf, data['category'], test_size=0.2, random_state=42) ``` 9. 训练朴素贝叶斯分类器 ```python naive_bayes = MultinomialNB() naive_bayes.fit(X_train, y_train) ``` 10. 预测测试集 ```python y_pred = naive_bayes.predict(X_test) ``` 11. 计算准确率 ```python accuracy = accuracy_score(y_test, y_pred) print('Accuracy:', accuracy) ``` 以上就是对BBC新闻进行分类的Python代码。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值