0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

1 / 2

目的

MTシステムなどの手法の項目選択に使うため、2水準直交表の作成のプログラムのメモ

参考にさせていただいたページ

import numpy as np
## 認証を行ってグーグルドライブをマウントする
from google.colab import drive
drive.mount('/content/drive')

#基準になるL4直交表
l4 = [
    [1,1,1],
    [1,2,2],
    [2,1,2],
    [2,2,1]
]
L4 = np.array(l4,dtype=np.int16)


def Mplus(M):
  return 2 - (M + 1) % 2
#直交表を作成 Lは直交表のサイズ(4×2^自然数)
def make_org(L):
  if L == 4:
    return L4
  retu1 = np.vstack([np.ones((int(L/2) , 1)),np.ones((int(L/2) , 1))*2])
  M = make_org(int(L/2))
  M1 = np.vstack([np.hstack([M,M]),np.hstack([M,Mplus(M)])])
  return np.hstack([retu1,M1])

%cd "直交表のCSVを保存するファイルのパス"

#nは直交表の個数
n = 9

for i in range(n):
  print(2**i * 4)
  L = 2**i * 4
  np.savetxt("二水準L"+ str(L) + "_" + str(L -1)+ '因子直交表.csv',make_org(L),delimiter=',', fmt='%d')


直交表の各項目の交互作用を考慮した割付の自動化などが分からないため、参考できるページやコードなどを教えていただけるとありがたいです。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?