A basic manualof LIDG program

Hitoshi Fujii

Outline••••••••

Configuration of LIDG program
Workflow of interpretable sparse modeling by LIDG
Flowchart
Term description
Methods
The meaning of subspace list
Definition of criteria
An example of backward selection method

Configuration of LIDG program
plots

database.RelationalDataBase

base_span.BaseSpan

label_calculator.LabelCalculator

inheritanceprojection.Projection

linear_span.LinearSpan
multicollinearity skl_enet
lidg/__init__.py
base_span.pylabel_calculator.py
linear_span.py
projection.py
multicollinearity.py
statistics.py
skl_enet.py
plots.py
database.py

statistics

Basic method to handle DataFrame
Label handling, calculation of strings
Main program
Linear regression
Find multicollinearities in span
Statistic calculations
Elastic net calculation by sklearn
Plotting method
Handle a relational database

Workflow of interpretable sparse modeling by LIDG
1. Read target and descriptor vectors
2. Generate first order descriptors by basic operations (BO)
3. Find and remove multicollinearities (MCL)
4. Find and remove strong near multicollinearities (NMCL)
5. Perform OLS and check the accuracy of the model. If the accuracy issufficient, then go to 8.
6. Generate higher order descriptors by direct product (DP)7. Go to 3. (Repeat until the regression model reaches a sufficient accuracy)
8. Perform a descriptor selection, such as BS, LASSO, MCTS, etc.

Flowchart

Term description
7oLinear spanp^SZ Xhjn:%0=GlfimYDUIbFRdaMclfim5BYOVG
gnkm5BF32%lfimF<@lfimF<@5BF<@9 :!Ygnkm->oY(HW-" XQc pe4VPS!) gnkm5B"e8KcGIcTY-" e32%PFgnkm->XQc32%Y YAegnkm5BY!) lfimV_WQGOde32%lfim#V\OVXQcG
(XFY$Y-" o<@p`gnkm5BYlfimV:WPFOda$Y!
) lfime<@lfimV\OVXQcG<@lfimYD% ≡ '( , '* , … , '$e8KFRdaMco/#Qcp5Be<@5B, ≡ -./0(%) ⊂ "V\OVXQcG<@lfime lfimVPS!×$9 Z<@9 o;19 p 5 ≡'( , '* , … , '$ V[dcGOY&6/07 5 = 9:;(,) M#b6TGT^bhjnYY%o7.6WlfimY%pZ<@9 YC%La+^cG',oOLSp:
2XZFhjn,o?EpX32%lfim#e!ovector projectionpPSl=
fime:TNcOVXWaWJGo<# = 5>p*oresidualp:
vector rejectionFT^bFOLSUY$
<pG#<La32%lfim#]Ylfimo? = # −#Methods (1/6) (basic methods).read(str or df)
hu|h ^lfhnrcey[IEVpandasm|jrz|vb0X1Y=.set_y(str)m|jrz|vB]xty}str~PIM&%b9I<L`bgxhself.yT*K_=
.add_const()
:tgnyCFA]`_=.change_labels(str).2Uxtyb5I$ DUIMxty}str~T=.show()hq{U.2tgnyU<L`]Uxtyb-(K_=.show_save()pkgdks#hq{U.2tgnyU<L`]Uxtyb-(K_=hq{T6K_gxhV3N>^<NVpkgdks#U[U}self.x_save~P<[@NV #U[U}self.x~P>_=8U#PV< #hq{U.2b 7IM^MS.2b3 IO)SRb4'/K_Q?@\@SGQC;+T,a`_UP<GU\@T<?NP[ T`_!<pkgdksUMZUgxhb#IO?_=U3N&UgxhVself.originP>^<G`V
MS.2b_8Ta`_=.readP0X1W`M"PVG`]3NVOJP>_=WM<hq{b?E]IO[<self.originCH`_GQVS?=}.new()wikob7?O=~

Methods (2/6) (basic methods).save()!%`foN12qself.xrWea\Xah%`foqself.x_saverP]gp@U8.load(str or list)ea\Xah%`foqself.x_saver N?D12W!%`foqself.xrP3 @U8.remove(str or list)
?D12W!%`fo<S 6@U8ea\XahOCNQQ8Zh^jo “const”: i\cmW/G=I 6@U8“inf”: '?D.*WG12i\cmW/G=I 6@U8“all”: IN12W 6@U8.add(str or list) qrW;UK7self.origin N12MH:I12WDMT7`foM3 @U8?DkimJW :IR7 4J INkimWZl_dmkimQJ?I<SNW0)@
UNJ7kimNW#MBA12+8qself.originM(5>VI:U12WFD$)O0)+8DE?7O,&M;U8r.add_rh()"i\cmW`foM3 8-9Lb`cM;U8.add_rg()[Y^Xoi\cmW`foM3 8-9Lb`cM;U8.plot(df,series), .plot_vs(series1,series2): pandas.DataFrame7pandas.SeriesNhnac

Methods (3/6) (generation, symmetrization).new(renew=True): return spanm Ww*bk |ySrenew=Truei_yiR*bk mself.xXself.originp~]zyS
fqxR|/^gTbRazXoriginp-]zg^qTRtnu0 mm"X{zyS^W^R\zlvxR70 mlTdTd$egHK|G=^kZgvZkymhRG=.
O|9@hYy3lkyS.sub(str or list): return span%^bN  |J_S.join(str or list): return span%^b |L concat^b |J_S.gen_bo(str or list): return span
15=lvxHK|6#_yS“r”nM(R“a”n?R”b”n?mM(S”r+””r-”nHKmmM(S gm>r{`|G=S”a+”,”b+”t3S*bk15=|D hC^bTnRlabel_calculator.pymmRop1_diclL _zoETSVoR+2|iy5=kw”u”R%(P(kw”e”kjiR5=|)c[hF_3l_yS.gen_dp(int): return span
8;lvxHK|6#_ySQ4HK6#
.sym(list): return span
:^bHK|J_S\z|UlnRHKmXx(0,1,2,..)m3lI X,H]zgkT
iT[kTS(ln[(0,1,2,..),(1,0,2,…),(0,2,1,..),…]m3lA&m h!<'|sb gm:'|VyS\zwXB|#^gkTi}ikyS

Methods (4/6) (multicollinearity).lid(normalize=False,tole1,tole2): return spanR EL|`}nnormalize=True } "fR0g vZ=|^a%
*}n d5()0m^a%7Z={¡tole1v+{r mx;^a%kG'v"fR0g Yy?n|m,ukN.^a%r! 4$¡mtole1+{x}z mN.^a%HA}z vwn"fR0g vq!mQ]&Hm^a%vVr^
a%u rs6vwxqvm\eT rs[DumN.^a%
Xj vlr 6}ntole2#wx} >}R.EL Y{¡^a%5vBnm^a%v
z mP< |m-rC"fR03i}z vwnU8"fR0g
rhm"fR0 C"fR0 br 5H¡:9qn"fR0vq!^a%c12@ |oN{pmo_K#w{pmo! Ig-{pvStn.volume_comb(defi_list,cand_list,k,ntop=None)defi_list/~ F}^a%2)|mcand_listuk }_K]M|mntopO}n.xty()
^a% ! Ig"# !]M}nWcm^a%JMethods (5/6) (near multicollinearity).project(sort=None, normalize=False)
OLSn@OLnormalize=True_Yk_KC-W\DG~sybYk'nYkLUlb
hjK'cSVn|qob2FYkU_R^Sk/bakL%Rself.hyb-:VlkL%9 |pwxpt9c#0e2: 1)Kmse: mean square error e2nu}'^R2: 5']\fcKrmse: msec),69 39c#0eq2: 61Kmseq: 61nu}'^ ]\fcKrmseq: mseqc),Q2: 6bYk5' leave-one-out cross validationc;+_XbakL
AIC: E4!I7TR2, TQ2Zl[lK>8aR2K>8aQ2LUlidKyc & bmnQT\fccmjbKyc{^e2Kqe2n ]\fcLUcLIDG}trvzc#0^MjKR2KQ2_\$k?NnYkLb, |b|: '_Zc<L
p_val, -log10(p) : 'cT.cp_KZlc'n]\fcL-log10(p)RSNe`HBa
DG_ (^SkL
G2: DGcHBc#0 LIDGrvzLC-W\DGbYk|b|gK-log10(p)_X$k?NnYk_*VlkL
TRi2: 7H= cVnAW LIDGrvzKVIFa`_/c$k?NnYkL'Jn"PkL

Methods (6/6).rij(ntop)
SHMX>*Z 36&'
.nij(ntop)$ 36&'>[>1.TH/Dntop@:,>G%3+1.B>/Dntop@:,.gij(ntop)
# *ZIVKRW>[,SHMX>*:?!3/:1<.0+2># *?)!B"36;<79.E,.gik(str,ntop)-E8>&'G3+5F;># *G%4E,.corr(ntop).rij()+.nij()+.gij()G@;A9,.outlier()F>%,OJ>+(LNUYPXQ.enet(almax=2,almin=-4,l1r=1.0,nf=10)
Sklearn=CEElastic Net>%,almin-almax: Hyperparameter>>,l1r = 1.0 for LASSO, l1r=0.0 for Ridge regression
nf: fold number of cross validation

+ (LNUYPXQ+DFFITSG%,The meaning of subspace list
;M>,#.

FJ4ESQR(!" = $"% !% + $"' !'!( = $(% !% + $(' !')!) = $ )% !% + $ ' !'!" , !( , !) , !% , !'Temporary basis:FF

5@5K2@F

T+

=L:CE=L

/:F5@F)*6L!+,-.(!% , !' , !" , !( , !) )FG2@?9B%3:C6N5L0

O$E+PB%3T!-F@GINMD3U

Select !% , !' and remove !" , !( , !)or
select !% , !" and remove !' , !( , !)or
select !( , !) and remove !% , !' , !"…
G&12L6/ EG<>3IFO=J4E=MH%30U:FJ4E<A/"O8'C=:CD8)*FOK=:C6B7L0

Definition of critria

TRi2$G2
Jrejection operator
:J0 +')."rejection &-,#
J(I,j)xixj%(*/"   !
rejection%#An example of backward selection method
LIDG.]bM;14_CDSh_j; tmoruThkM#5aLPpn
qThkjNYSYMhkjpnqb>`mosm]b_PN
AG<_mosmpnqt6K agQ_faulj`bM$e\CDF!l?Q
@TOjN

EF!.a"I:
1. CDa`RVjH@l Zj G2 TXPCDl3*2`iJUgQ`ZjN
2. %t9uT_jcUXPCDliJUgQ`ZjN
3. JZjW^]M#5MR2MTR2TOdiTh_PgQ_CDlJ
ZjN
4. JZjW^]M0t- u5 Q2MTQ2T'YMAICTTjgQ_C
DlJZjN
WagQ`M8B",l82` &YMTQ2T(`_jd]t7+M/=P)^_jNu
OjPbMOj"Y[%`_jd]:VjN

JY:VjN