根据python中的描述预测性别

问题描述 投票:0回答:1

我有一个在线约会网站的数据集(出于隐私原因,我无法共享),但是我会提供此问题所需的所有信息。数据集包含9个由用户编写的描述(des1,des2,des3等),以及名称,年龄,性别等。因此,我需要构建一个程序,可以预测...的性别用户基于这9个描述]]。我已经在数据集中找到了性别,但是我需要构建一个程序来根据这些描述进行预测。我有这个,但不知道如何前进。

%matplotlib inline
%config InlineBackend.figure_format='svg'
from IPython.display import display,HTML
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from prettypandas import PrettyPandas
sns.set_style("ticks")
sns.set_context(context="notebook",font_scale=1)

d=pd.read_csv("dataset.csv", nrows=400)
print("The dataset contains {} records".format(len(d)))

m=d[d["gender"]=="m"]
f=d[d["gender"]=="f"] 
print("{} males ({:.1%}), {} females ({:.1%})".format(
    len(m),len(m)/len(d),
    len(f),len(f)/len(d)))

PrettyPandas(d                                  
    .head(3)                                    
    [[c for c in d.columns if "essay" not in c]] 
)
print("Age statistics:\n{}".format(d["age"].describe()))
print()
print("There are {} users older than 80".format((d["age"]>80).sum()))

PrettyPandas(d[d["age"]>80])

d=d[d["age"]<=80]

print("The dataset now contains {} records".format(len(d)))

m=d[d["gender"]=="m"] 
f=d[d["gender"]=="f"] 
print("{} males ({:.1%}), {} females ({:.1%})".format(
    len(m),len(m)/len(d),
    len(f),len(f)/len(d)))

print()
print("Age statistics:\n{}".format(d["age"].describe()))

我有一个在线约会网站的数据集(出于隐私原因,我无法共享),但是我会提供此问题所需的所有信息。数据集有9个描述,它们由...

python predict
1个回答
0
投票

这是一个常见的NLP问题,有很多文章试图解决它。

© www.soinside.com 2019 - 2024. All rights reserved.