‘FactorAnalyzer‘ object has no attribute ‘analyze‘和fa.loadings改成fa.loadings报错解决
@Author:Runsen
在使用Python进行因子分析和主成分分析的时候,很多人报 :‘FactorAnalyzer’ object has no attribute 'analyze’和fa.loadings改成fa.loadings_。
这是版本的问题:
我们先到 Github的网站看看: https://github.com/EducationalTestingService/factor_analyzer
可以看到对应的更新文档,你就会发现’FactorAnalyzer’ object has no attribute ‘analyze’ 其实是你下载了最新的版本,因为很多FactorAnalyzer的文章都是2018年。
在最新版本没有analyze的APi,因此解决的方法可以回退pip install factor_analyzer==0.2.3
或者直接使用官方文档的示例: https://readthedocs.org/projects/factor-analyzer/
>>> import pandas as pd
>>> from factor_analyzer import FactorAnalyzer
>>> df_features = pd.read_csv('tests/data/test02.csv')
>>> fa = FactorAnalyzer(rotation=None)
>>> fa.fit(df_features)
FactorAnalyzer(bounds=(0.005, 1), impute='median', is_corr_matrix=False,method='minres', n_factors=3, rotation=None, rotation_kwargs={},use_smc=True)
>>> fa.loadings_
array([[-0.12991218, 0.16398154, 0.73823498],[ 0.03899558, 0.04658425, 0.01150343],[ 0.34874135, 0.61452341, -0.07255667],[ 0.45318006, 0.71926681, -0.07546472],[ 0.36688794, 0.44377343, -0.01737067],[ 0.74141382, -0.15008235, 0.29977512],[ 0.741675 , -0.16123009, -0.20744495],[ 0.82910167, -0.20519428, 0.04930817],[ 0.76041819, -0.23768727, -0.1206858 ],[ 0.81533404, -0.12494695, 0.17639683]])
>>> fa.get_communalities()
array([0.588758 , 0.00382308, 0.50452402, 0.72841183, 0.33184336,0.66208428, 0.61911036, 0.73194557, 0.64929612, 0.71149718])
loadings和loadings_ 一样
‘FactorAnalyzer‘ object has no attribute ‘analyze‘和fa.loadings改成fa.loadings报错解决相关推荐
- Can't process attribute android:fillColor=@color/gray,添加vector属性报错解决方法
Android studio添加vector属性文件报错 vector属性文件 <vector xmlns:android="http://schemas.android.com/ap ...
- 报错解决:AttributeError: ‘Word2VecKeyedVectors‘ object has no attribute ‘save_Word2Vec_format‘
报错解决:AttributeError: 'Word2VecKeyedVectors' object has no attribute 'save_Word2Vec_format' 不知道按网上自己学 ...
- 报错解决:TypeError: Object type class 'str' cannot be passed to C code
此文首发于我的个人博客:报错解决 TypeError Object type class 'str' cannot be passed to C code - zhang0peter的个人博客 下午在 ...
- Object not found! The requested URL was not found on this server.... 报错解决方案
Object not found! The requested URL was not found on this server.... 报错解决方案 参考文章: (1)Object not foun ...
- TypeError: ‘builtin_function_or_method‘ object is not subscriptable 报错解决方法
TypeError: 'builtin_function_or_method' object is not subscriptable 报错解决方法 参考文章: (1)TypeError: 'buil ...
- no main manifest attribute maven package 运行打包后的jar包报错:xxx.jar中没有主清单属性 通过配置 maven plugin 解决
文章目录 命令行运行生成的jar包,报错 解决 手动修复 修改打包规则 一劳永逸 MANIFEST.MF demo Others IDEA 中关于 main class 的配置 命令行运行生成的jar ...
- Python 报错解决:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
早上升级完pip,后报错如下: -> # pip install --upgrade pwntools /usr/local/lib/python2.7/dist-packages/pip/_v ...
- CLion报错解决:allocating an object of abstract class type--unimplemented pure virtual method
在用CLion写代码时遇到了这个报错: allocating an object of abstract class type '...' unimplemented pure virtual met ...
- mxnet报错解决:AttributeError: module 'mxnet.context' has no attribute 'num_gpus'
早上在跑mxnet的mnist的示例代码时报错了,代码如下: import mxnet as mx ctx = mx.gpu(0) if mx.context.num_gpus() > 0 el ...
最新文章
- 算法设计与分析 0 算法与性能:GCD与冒泡排序
- __tostring和__invoke 方法
- python的os模块批量获取目标路径下的文件名
- 三分钟构建高性能 WebSocket 服务 | 超优雅的 SpringBoot 整合 Netty 方案
- 最新:全球大型数据中心总数增至597个,是2015年数据中心数量的两倍
- 组件通信之pubsub
- Android 应用开发----ViewPager---PagerTitleStrip添加标题栏
- SQL:查询、替换字符串中的回车、换行、回车换行
- 写于公元2006年2月14日
- Mysql漏洞修复方法思路及注意事项
- 招聘|月薪20-40K|上海莱陆科技招高级机器人、​Android研发工程师
- 2017-2018-1 20155317《信息安全系统设计基础》 实验五 通讯协议设计
- python 软件包 petri_常用Petri网模拟软件工具简介
- python分离gif_python 将GIF拆分成图片方法
- java emf 转jpg_JAVA读取EMF文件并转化为PNG,JPG,GIF格式
- yudian温控表a1温度怎么补偿_厦门宇电yudian温控表AI-516/516P型人工智能温度调节器控制器-恩莱自动化官网...
- 爱快路由研究中关于rootfs.gz文件的解压缩问题
- python打开paint并画一个圆
- 计算机组成原理学习-实验一 运算器实验(详细、系统)
- 家用智能投影推荐 五千元档的当贝F5和当贝X3有哪些区别?