relativeimp是一个python包,用于执行关键驱动程序分析并按驱动程序生成相对重要性。
relativeImp的Python项目详细描述
相对重要性计算器
简介
关键驱动因素分析是市场研究中一个流行而强大的工具,可以量化单个驱动因素在预测结果变量方面的相对重要性。例如,市场营销研究人员使用客户体验调查响应进行关键驱动因素分析,以了解哪些方面的客户体验最能驱动客户的总体满意度。
由于驱动因素之间往往高度相关,典型的多元回归分析会产生驱动因素重要性的缺陷指标。相反,我们采用relative weight analysis方法,精确地划分相关驱动程序之间的差异。
相对重要性计算器按驱动程序为指定的结果变量生成原始的和规范化的相对重要性。原始相对重要性之和等于r平方(即结果变量中可由所有驱动因素解释的总变化比例),标准化相对重要性之和等于1。
先决条件
要使用相对重要性计算器,需要安装pandas和numpy。
安装
从PyPI:
安装相对重要性计算器pip install relativeImp
输入和输出
相对重要性计算器接受三个必需的输入参数,并返回一个pandas数据框:
输入参数:
df: pandas.core.frame.DataFrame
Raw input data, e.g. survey responses
outcomeName: str
Name of the single outcome variable, e.g. overall satisfaction scores
driverNames: list
Names of the driver variables, e.g. satisfication drivers such as quality, ease of use etc.
输出:
pandas.core.frame.DataFrame with three columns:
driver: names of the driver variables
rawRelaImpt: the raw relative importance whose sum equals R-squared
normRelaImpt: the normalized relative importance whose sum equals one
示例代码
importpandasaspdfromrelativeImpimportrelativeImpdf=pd.read_excel("raw_survey_responses.xlsx")yName='Overall Satisfaction'xNames=['Response Time to the Service Call','Efficiency of Handling the Service Call','Answer/Solution Provided','Knowledge of the Service Personnel','Communication Skills of the Service Personnel','Professionalism of the Service Personnel']df_results=relativeImp(df,outcomeName=yName,driverNames=xNames)
创建者
版权所有©2019 Dan Yang