clear all;
load carbig
X=[Acceleration Displacement Horsepower MPG Weight];
X=X(all(~isnan(X),2)😅;
%估计因素负荷矩阵
[Lambda,Psi,T,stats,F]=factoran(X,2,‘scores’,‘regression’);
Lambda %输出因素负荷矩阵
inv(T’T) %F的相关矩阵
LambdaLambda’+diag(Psi)%X的相关矩阵
Lambdainv(T) %未经旋转的因素负荷矩阵
FT’; %未经旋转的因素贡献率
%绘制未经旋转的负荷点和旋转斜坐标
invT=inv(T);
Lambda0=Lambda*invT;
biplot(Lambda,‘LineWidth’,2,‘MarkerSize’,20);
line([-invT(1,1),invT(1,1),NaN,-invT(2,1),invT(2,1)],[-invT(1,2),invT(1,2),NaN,-invT(2,2),invT(2,2)]);
XiuYanJiang YuanCaiChen,XiangYuChen
Lambda =
-0.2432 -0.8500
0.8773 0.3871
0.7618 0.5930
-0.7978 -0.2786
0.9692 0.2129
ans =
1.0000 -0.0000
-0.0000 1.0000
ans =
1.0000 -0.5424 -0.6893 0.4309 -0.4167
-0.5424 1.0000 0.8979 -0.8078 0.9328
-0.6893 0.8979 1.0000 -0.7730 0.8647
0.4309 -0.8078 -0.7730 1.0000 -0.8326
-0.4167 0.9328 0.8647 -0.8326 1.0000
ans =
-0.5020 0.7277
0.9550 -0.0865
0.9113 -0.3185
-0.8450 0.0091
0.9865 0.1079
clear all;
load carbig
X=[Acceleration Displacement Horsepower MPG Weight];
X=X(all(~isnan(X),2)😅;
%估计因素负荷矩阵
[Lambda,Psi,T,stats,F]=factoran(X,2,‘scores’,‘regression’);
Lambda %输出因素负荷矩阵
inv(T’T) %F的相关矩阵
LambdaLambda’+diag(Psi)%X的相关矩阵
Lambdainv(T) %未经旋转的因素负荷矩阵
FT’; %未经旋转的因素贡献率
%绘制未经旋转的负荷点和旋转斜坐标
invT=inv(T);
Lambda0=Lambda*invT;
biplot(Lambda,‘LineWidth’,2,‘MarkerSize’,20);
line([-invT(1,1),invT(1,1),NaN,-invT(2,1),invT(2,1)],[-invT(1,2),invT(1,2),NaN,-invT(2,2),invT(2,2)]);
xlabel(‘载入因素1’);
ylabel(‘载入因素2’);
张德丰编著—MATLAB概率与数据统计分析----第305页—【M】北京:机械工业出版社
属性 Properties
Copyright © 2004-2019 by
Aric Hagberg hagberg@lanl.gov
Dan Schult dschult@colgate.edu
Pieter Swart swart@lanl.gov
All rights reserved.
BSD license.
import matplotlib.pyplot as plt
from networkx import nx
G = nx.lollipop_graph(4, 6)
pathlengths = []
print(“source vertex {target:length, }”)
for v in G.nodes():
spl = dict(nx.single_source_shortest_path_length(G, v))
print(’{} {} '.format(v, spl))
for p in spl:
pathlengths.append(spl[p])
print(’’)
print(“average shortest path length %s” % (sum(pathlengths) / len(pathlengths)))
histogram of path lengths
dist = {}
for p in pathlengths:
if p in dist:
dist[p] += 1
else:
dist[p] = 1
print(’’)
print(“length #paths”)
verts = dist.keys()
for d in sorted(verts):
print(’%s %d’ % (d, dist[d]))
print(“radius: %d” % nx.radius(G))
print(“diameter: %d” % nx.diameter(G))
print(“eccentricity: %s” % nx.eccentricity(G))
print(“center: %s” % nx.center(G))
print(“periphery: %s” % nx.periphery(G))
print(“density: %s” % nx.density(G))
nx.draw(G, with_labels=True)
plt.show()
节点颜色Node Colormap
Author: Aric Hagberg ,modified by Chen Xiang Yu(hagberg@lanl.gov,cxy_0809@qq.com)
import matplotlib.pyplot as plt
import networkx as nx
G = nx.cycle_graph(28)
设置排列位置,iterations迭代次数
pos = nx.spring_layout(G, iterations=300)
node_color节点颜色
nx.draw(G, pos, node_color=range(28), node_size=900, cmap=plt.cm.Blues)
plt.show()
nx.draw(G, pos, node_color=range(28), node_size=900, cmap=plt.cm.Reds)
nx.draw(G, pos, node_color=range(28), node_size=900, cmap=“Accent”)
nx.draw(G, pos, node_color=range(28), node_size=900, cmap=“Accent_r”)
nx.draw(G, pos, node_color=range(28), node_size=900, cmap=“Blues_r”)
nx.draw(G, pos, node_color=range(28), node_size=900, cmap=“Reds_r”)
nx.draw(G, pos, node_color=range(28), node_size=900, cmap=“Set1”)
Servlet第一讲:https://v.youku.com/v_show/id_XNTA5MjY1NDMyMA==.html
Servlet第五讲:https://v.youku.com/v_show/id_XNTA5MjY3NDU3Ng==.html
Servlet第四讲:https://v.youku.com/v_show/id_XNTA5MjY3MzU0NA==.html
Servlet第六讲:https://v.youku.com/v_show/id_XNTA5MjY3NTQwOA==.html
Servlet第九讲://v.youku.com/v_show/id_XNTA5MjY3NzkxMg==.html