TensorFlow开发者证书考试指南

需积分: 10 7 下载量 35 浏览量 更新于2024-09-05 收藏 110KB PDF 举报
“TF_Certificate_Candidate_Handbook.pdf - TensorFlow考试手册,涵盖了考试内容、形式、费用等关键信息,重点涉及使用TensorFlow 2.x构建和训练神经网络模型,图像分类,自然语言处理(NLP),时间序列、序列及预测。” 在深入探讨TensorFlow Developer Certificate的考试细节之前,首先理解TensorFlow的重要性是至关重要的。TensorFlow是一个开源的机器学习库,由Google Brain团队开发,广泛用于深度学习、自然语言处理、计算机视觉等多个领域。TensorFlow 2.x版本引入了更友好的API,更加灵活且易于使用,同时提供了丰富的工具和库支持。 考试内容与技能清单: 1. **构建和训练神经网络模型使用TensorFlow 2.x**:这要求考生具备机器学习和深度学习的基本原理知识,并能够使用TensorFlow 2.x进行实践。你需要能够: - 使用TensorFlow 2.x API,包括数据流图和Eager Execution模式。 - 构建、编译和训练机器学习模型,如线性回归、逻辑回归、支持向量机等。 - 实现神经网络架构,包括卷积神经网络(CNN)和循环神经网络(RNN)。 - 使用优化器(如Adam)、损失函数和评估指标来训练模型。 2. **图像分类**:这部分将评估考生对图像识别任务的理解和实现能力,可能包括预处理技术、卷积神经网络(CNNs)的使用以及迁移学习的应用。 3. **自然语言处理(NLP)**:考生需要熟悉文本数据的预处理,了解词嵌入(如Word2Vec、GloVe),掌握序列到序列模型(Seq2Seq)、注意力机制(Attention Mechanism)以及Transformer模型的应用。 4. **时间序列、序列及预测**:这部分考察考生处理时间依赖数据的能力,包括使用LSTM(长短期记忆网络)或其他RNN变种进行序列建模,以及如何进行时间序列预测。 考试环境与规定: - 考试可能在线进行,要求考生提供一个无干扰的环境。 - 考试时长和URL会在手册中详细说明。 - 考生的身份验证可能是通过身份证件和/或视频监控来完成。 - 在考试期间,允许使用的资源可能会有明确的规定,例如,可能不允许使用互联网或参考材料。 报名、费用和支付: - 符合条件的考生可以注册参加考试,具体条件应在手册中列出。 - 考试费用也会在手册中详细说明,考生需要提前支付。 - 支付方式可能包括信用卡或其他在线支付方式。 考试流程: - 考生需要按照指定的时间和URL登录进行在线考试。 - 考试结束后,成绩通常会在一定时间内公布。 证书的有效期和重考政策: - 一旦获得证书,其有效期通常为一定年限。 - 如果未通过考试,考生可能有机会重新参加考试,重考政策会在手册中详细说明。 最后,手册中的“非歧视声明”部分强调了公平公正的考试原则,确保所有符合资格的考生都有平等的机会参与和成功。 TensorFlow Developer Certificate的考试涵盖了广泛的TensorFlow 2.x应用,要求考生不仅要有深厚的理论基础,还要有实践经验。通过这个认证,考生将证明自己在构建和应用机器学习模型方面的能力,从而提升在IT领域的专业价值。

import pandas as pd import math as mt import numpy as np from sklearn.model_selection import train_test_split from Recommenders import SVDRecommender triplet_dataset_sub_song_merged = triplet_dataset_sub_song_mergedpd triplet_dataset_sub_song_merged_sum_df = triplet_dataset_sub_song_merged[['user','listen_count']].groupby('user').sum().reset_index() triplet_dataset_sub_song_merged_sum_df.rename(columns={'listen_count':'total_listen_count'},inplace=True) triplet_dataset_sub_song_merged = pd.merge(triplet_dataset_sub_song_merged,triplet_dataset_sub_song_merged_sum_df) triplet_dataset_sub_song_merged['fractional_play_count'] = triplet_dataset_sub_song_merged['listen_count']/triplet_dataset_sub_song_merged small_set = triplet_dataset_sub_song_merged user_codes = small_set.user.drop_duplicates().reset_index() song_codes = small_set.song.drop_duplicates().reset_index() user_codes.rename(columns={'index':'user_index'}, inplace=True) song_codes.rename(columns={'index':'song_index'}, inplace=True) song_codes['so_index_value'] = list(song_codes.index) user_codes['us_index_value'] = list(user_codes.index) small_set = pd.merge(small_set,song_codes,how='left') small_set = pd.merge(small_set,user_codes,how='left') mat_candidate = small_set[['us_index_value','so_index_value','fractional_play_count']] data_array = mat_candidate.fractional_play_count.values row_array = mat_candidate.us_index_value.values col_array = mat_candidate.so_index_value.values data_sparse = coo_matrix((data_array, (row_array, col_array)),dtype=float) K=50 urm = data_sparse MAX_PID = urm.shape[1] MAX_UID = urm.shape[0] recommender = SVDRecommender(K) U, S, Vt = recommender.fit(urm) Compute recommendations for test users uTest = [1,6,7,8,23] uTest_recommended_items = recommender.recommend(uTest, urm, 10) Output recommended songs in a dataframe recommendations = pd.DataFrame(columns=['user','song', 'score','rank']) for user in uTest: rank = 1 for song_index in uTest_recommended_items[user, 0:10]: song = small_set.loc[small_set['so_index_value'] == song_index].iloc[0] # Get song details recommendations = recommendations.append({'user': user, 'song': song['title'], 'score': song['fractional_play_count'], 'rank': rank}, ignore_index=True) rank += 1 display(recommendations)这段代码报错了,为什么?给出修改后的 代码

2023-06-08 上传

将上述代码放入了Recommenders.py文件中,作为一个自定义工具包。将下列代码中调用scipy包中svd的部分。转为使用Recommenders.py工具包中封装的svd方法。给出修改后的完整代码。import pandas as pd import math as mt import numpy as np from sklearn.model_selection import train_test_split from Recommenders import * from scipy.sparse.linalg import svds from scipy.sparse import coo_matrix from scipy.sparse import csc_matrix # Load and preprocess data triplet_dataset_sub_song_merged = triplet_dataset_sub_song_mergedpd # load dataset triplet_dataset_sub_song_merged_sum_df = triplet_dataset_sub_song_merged[['user','listen_count']].groupby('user').sum().reset_index() triplet_dataset_sub_song_merged_sum_df.rename(columns={'listen_count':'total_listen_count'},inplace=True) triplet_dataset_sub_song_merged = pd.merge(triplet_dataset_sub_song_merged,triplet_dataset_sub_song_merged_sum_df) triplet_dataset_sub_song_merged['fractional_play_count'] = triplet_dataset_sub_song_merged['listen_count']/triplet_dataset_sub_song_merged['total_listen_count'] # Convert data to sparse matrix format small_set = triplet_dataset_sub_song_merged user_codes = small_set.user.drop_duplicates().reset_index() song_codes = small_set.song.drop_duplicates().reset_index() user_codes.rename(columns={'index':'user_index'}, inplace=True) song_codes.rename(columns={'index':'song_index'}, inplace=True) song_codes['so_index_value'] = list(song_codes.index) user_codes['us_index_value'] = list(user_codes.index) small_set = pd.merge(small_set,song_codes,how='left') small_set = pd.merge(small_set,user_codes,how='left') mat_candidate = small_set[['us_index_value','so_index_value','fractional_play_count']] data_array = mat_candidate.fractional_play_count.values row_array = mat_candidate.us_index_value.values col_array = mat_candidate.so_index_value.values data_sparse = coo_matrix((data_array, (row_array, col_array)),dtype=float) # Compute SVD def compute_svd(urm, K): U, s, Vt = svds(urm, K) dim = (len(s), len(s)) S = np.zeros(dim, dtype=np.float32) for i in range(0, len(s)): S[i,i] = mt.sqrt(s[i]) U = csc_matrix(U, dtype=np.float32) S = csc_matrix(S, dtype=np.float32) Vt = csc_matrix(Vt, dtype=np.float32) return U, S, Vt def compute_estimated_matrix(urm, U, S, Vt, uTest, K, test): rightTerm = S*Vt max_recommendation = 10 estimatedRatings = np.zeros(shape=(MAX_UID, MAX_PID), dtype=np.float16) recomendRatings = np.zeros(shape=(MAX_UID,max_recommendation ), dtype=np.float16) for userTest in uTest: prod = U[userTest, :]*rightTerm estimatedRatings[userTest, :] = prod.todense() recomendRatings[userTest, :] = (-estimatedRatings[userTest, :]).argsort()[:max_recommendation] return recomendRatings K=50 # number of factors urm = data_sparse MAX_PID = urm.shape[1] MAX_UID = urm.shape[0] U, S, Vt = compute_svd(urm, K) # Compute recommendations for test users # Compute recommendations for test users uTest = [1,6,7,8,23] uTest_recommended_items = compute_estimated_matrix(urm, U, S, Vt, uTest, K, True) # Output recommended songs in a dataframe recommendations = pd.DataFrame(columns=['user','song', 'score','rank']) for user in uTest: rank = 1 for song_index in uTest_recommended_items[user, 0:10]: song = small_set.loc[small_set['so_index_value'] == song_index].iloc[0] # Get song details recommendations = recommendations.append({'user': user, 'song': song['title'], 'score': song['fractional_play_count'], 'rank': rank}, ignore_index=True) rank += 1 display(recommendations)

2023-06-07 上传