admin 发布的文章

一、

二、代码

##粗召回数据处理
pandas_df = pd.read_csv("./clothes_women_1356.txt",sep='\t',dtype=str)

schema = StructType([StructField("item_sku_id", StringType(), True)
                   ,StructField("item_first_cate_cd", StringType(), True)
                    ,StructField("item_first_cate_name", StringType(), True)
                    ,StructField("item_second_cate_cd", StringType(), True)
                    ,StructField("item_second_cate_name", StringType(), True)
                    ,StructField("item_third_cate_cd", StringType(), True)
                    ,StructField("item_third_cate_name", StringType(), True)
                     ,StructField("sku_name", StringType(), True)
                   ,StructField("pic", StringType(), True)])

spark_df = spark.createDataFrame(pandas_df, schema=schema)
spark_df.registerTempTable("match_fs")
xtl_df = get_recall_data(dt)
xtl_df = xtl_df.repartition(500)

如果虚拟环境已经配置好了tf或者pytorch环境可以直接调用

一、先测试环境是否可用

一般路径:/home/admin/anaconda3/envs/py36_tf2_fj/bin/python
注意测试的时候在bin 目录下不能用 python 需要使用./python

1.tf框架

import tensorflow as tf
tf.test.is_gpu_available()
结果如果为True代表tf环境可用

2.torch框架

import torch
torch.cuda.is_available()

深度学习的几个步骤
一、特征抽取

二、判别模块
对结果概率的判定:得到logits
具体衡量为:
1.通过linear层:分类
2.通过欧氏距离:是否同品
3.通过余弦距离:是否同品
三、损失函数
四、参数更新
误差方向传播