3

我英语说的不好。所以我请求你的耐心和编辑。

我分析了韩国的人口普查数据。我使用“adaboost”作为分析方法,并为每个城市实施了 adaboost。目标变量、自变量、公式、选项、观察次数等,城市之间都一样。没有区别。我做了一个宏,为城市一个一个实现adaboost。在开始分析下一个城市之前,宏会移除除自身之外的所有对象。

我发现随着时间的推移,平均处理速度越来越慢。我的意思是,1-30 号城市的平均所需时间约为 10 分钟,而 80-100 号城市则为 25 分钟。所以我终止了 R 会话并重新打开。我从第 80 个城市重新运行宏,然后将 80-100 个城市的平均时间减少到 10 分钟。

为什么会这样?我怎么解决这个问题?我需要你的帮助。提前致谢。


r 代码和宏如下。'sgg' 宏变量表示城市代码。目标变量有六个类别。所以我使用'one-others'方法进行多类分类。

memory.limit(size=4095)

library(gbm)
library(gtools)

dbset<-strmacro(sgg,sampnum,
 expr=
 {
 setwd("C:\\Users\\Kim\\Desktop\\JQ\\");
 db.sgg<-read.table('sgg.TXT', header=TRUE);
 db.sgg<-subset(db.sgg, AGE>=10)

 N<-nrow(db.sgg);
 if(N>=sampnum)
  {
  db.sgg<-db.sgg[sample(1:N, sampnum),]
  };

 db.sgg$SEX<-factor(letters[db.sgg$SEX])

 ordered(db.sgg$AREA);

 db.sgg$josagu_attri_mod2<-factor(letters[db.sgg$josagu_attri_mod])
 db.sgg$geocheo_type_mod2<-factor(letters[db.sgg$geocheo_type_mod])
 db.sgg$dandok_type_mod2<-factor(letters[db.sgg$dandok_type_mod])

 colnames(db.sgg)[10:15]<-c('FLC3.1','FLC3.3','FLC3.4','FLC3.5','FLC3.6','FLC3.7');
 }
 );

train<-strmacro(i, sgg,
expr={
   res.sgg.i<-gbm(FLC3.i~SEX+AREA+AGE+josagu_attri_mod2+geocheo_type_mod2+dandok_type_mod2,
    data=db.sgg, distribution='adaboost', n.trees=3000,shrinkage = 0.005,
    cv.folds=5, keep.data=TRUE,
    bag.fraction=0.7, interaction.depth=3);
   BI.sgg.i<-gbm.perf(res.sgg.i, method='cv');
   PRED.sgg.i<-predict.gbm(res.sgg.i, db.sgg, BI.sgg.i);
    }
    );


clean<-strmacro(sgg,
    expr={
        rm(BI.sgg.1);rm(BI.sgg.3);rm(BI.sgg.4);rm(BI.sgg.5);rm(BI.sgg.6);rm(BI.sgg.7);
        rm(res.sgg.1);rm(res.sgg.3);rm(res.sgg.4);rm(res.sgg.5);rm(res.sgg.6);rm(res.sgg.7);
        rm(PRED.sgg.1);rm(PRED.sgg.3);rm(PRED.sgg.4);rm(PRED.sgg.5);rm(PRED.sgg.6);rm(PRED.sgg.7);
        rm(db.sgg);
        }
        );

all<-strmacro(sgg,num,
    expr={
      dbset(sgg,num);
      train(1,sgg);train(3,sgg);train(4,sgg);train(5,sgg);train(6,sgg);train(7,sgg);
      clean(sgg);
        }
    );

all(11010,3000)
all(11020,3000)
all(11030,3000)

数据如下。此数据存储在“11010.txt”中。

  C3    mem_num josagu_attri_mod    SEX AGE geocheo_type_mod    dandok_type_mod C97 FLC3    FLC3_1  FLC3_3  FLC3_4  FLC_4   FLC3_6  FLC3_7  AREA
1   3   3   1   14  1   1   49  3   0   0   1   0   0   0   2
1   1   1   2   44  1   1   49  3   0   0   1   0   0   0   2
2   1   1   1   67  1   1   46  6   0   0   0   0   0   1   2
2   2   2   2   60  1   1   46  6   0   0   0   0   0   1   2
3   1   1   2   65  1   1   49  6   0   0   0   0   0   1   2
4   1   1   1   66  1   4   16  6   0   0   0   0   0   1   1
4   2   2   2   61  1   4   16  6   0   0   0   0   0   1   1
5   1   1   2   32  1   6   15  1   1   0   0   0   0   0   1
7   2   2   1   55  1   6   59  5   0   0   0   0   1   0   2
7   4   3   1   23  1   6   59  5   0   0   0   0   1   0   2
7   1   1   2   50  1   6   59  5   0   0   0   0   1   0   2
7   3   3   2   24  1   6   59  5   0   0   0   0   1   0   2
8   1   1   1   68  1   1   46  6   0   0   0   0   0   1   2
8   2   2   2   64  1   1   46  6   0   0   0   0   0   1   2
9   1   1   1   57  1   1   59  5   0   0   0   0   1   0   2
9   2   2   2   55  1   1   59  5   0   0   0   0   1   0   2
9   3   3   2   28  1   1   59  5   0   0   0   0   1   0   2
10  2   3   1   17  1   6   16  4   0   0   0   1   0   0   1
10  1   1   2   41  1   6   16  4   0   0   0   1   0   0   1
12  1   1   2   24  1   6   16  1   1   0   0   0   0   0   1
14  1   1   1   72  2   1   119 6   0   0   0   0   0   1   4
14  2   2   2   72  2   1   119 6   0   0   0   0   0   1   4
17  2   2   1   42  1   4   50  3   0   0   1   0   0   0   2
17  1   1   2   41  1   4   50  3   0   0   1   0   0   0   2
19  1   1   1   36  1   4   50  2   0   1   0   0   0   0   2
19  2   2   2   27  1   4   50  2   0   1   0   0   0   0   2
20  2   2   1   52  1   1   50  5   0   0   0   0   1   0   2
20  3   3   1   21  1   1   50  5   0   0   0   0   1   0   2
20  4   3   1   24  1   1   50  5   0   0   0   0   1   0   2
20  1   1   2   50  1   1   50  5   0   0   0   0   1   0   2
21  1   1   1   38  1   6   59  3   0   0   1   0   0   0   2
21  5   3   1   14  1   6   59  3   0   0   1   0   0   0   2
21  2   2   2   39  1   6   59  3   0   0   1   0   0   0   2
21  3   3   2   13  1   6   59  3   0   0   1   0   0   0   2
22  1   1   1   42  1   4   50  2   0   1   0   0   0   0   2
22  2   2   2   37  1   4   50  2   0   1   0   0   0   0   2
23  1   1   2   70  1   6   50  6   0   0   0   0   0   1   2
24  1   1   2   49  1   4   50  5   0   0   0   0   1   0   2
24  2   3   2   22  1   4   50  5   0   0   0   0   1   0   2
25  1   1   1   67  4   1   66  5   0   0   0   0   1   0   2
25  4   3   1   41  4   1   66  5   0   0   0   0   1   0   2
25  2   2   2   66  4   1   66  5   0   0   0   0   1   0   2
25  3   3   2   43  4   1   66  5   0   0   0   0   1   0   2
27  1   1   1   81  1   1   43  6   0   0   0   0   0   1   2
27  2   2   2   80  1   1   43  6   0   0   0   0   0   1   2
29  1   1   1   48  1   2   43  4   0   0   0   1   0   0   2
29  3   3   1   17  1   2   43  4   0   0   0   1   0   0   2
29  2   2   2   45  1   2   43  4   0   0   0   1   0   0   2
29  4   3   2   15  1   2   43  4   0   0   0   1   0   0   2
32  1   1   1   67  2   1   85  6   0   0   0   0   0   1   3
32  2   2   2   60  2   1   85  6   0   0   0   0   0   1   3
33  1   1   1   30  2   1   82  2   0   1   0   0   0   0   3
33  2   2   2   30  2   1   82  2   0   1   0   0   0   0   3
34  1   1   1   55  2   1   85  5   0   0   0   0   1   0   3
34  2   2   2   48  2   1   85  5   0   0   0   0   1   0   3
34  3   3   2   28  2   1   85  5   0   0   0   0   1   0   3
37  1   1   1   55  2   4   82  5   0   0   0   0   1   0   3
37  3   3   1   21  2   4   82  5   0   0   0   0   1   0   3
37  2   2   2   51  2   4   82  5   0   0   0   0   1   0   3
38  1   1   1   41  2   4   50  2   0   1   0   0   0   0   2
38  2   2   2   32  2   4   50  2   0   1   0   0   0   0   2
40  2   3   1   14  2   1   50  4   0   0   0   1   0   0   2
40  1   1   2   45  2   1   50  4   0   0   0   1   0   0   2
40  3   3   2   15  2   1   50  4   0   0   0   1   0   0   2
41  1   1   1   46  2   4   40  4   0   0   0   1   0   0   2
41  3   3   1   17  2   4   40  4   0   0   0   1   0   0   2
41  2   2   2   44  2   4   40  4   0   0   0   1   0   0   2
41  4   3   2   14  2   4   40  4   0   0   0   1   0   0   2
42  2   3   1   17  2   6   50  5   0   0   0   0   1   0   2
42  1   1   2   41  2   6   50  5   0   0   0   0   1   0   2
42  3   3   2   18  2   6   50  5   0   0   0   0   1   0   2
43  1   1   1   34  2   4   50  2   0   1   0   0   0   0   2
43  2   2   2   35  2   4   50  2   0   1   0   0   0   0   2
44  1   1   1   46  2   1   40  4   0   0   0   1   0   0   2
44  2   2   2   44  2   1   40  4   0   0   0   1   0   0   2
44  3   3   2   13  2   1   40  4   0   0   0   1   0   0   2
45  1   1   1   43  2   1   72  3   0   0   1   0   0   0   3
45  2   2   2   38  2   1   72  3   0   0   1   0   0   0   3
45  3   3   2   12  2   1   72  3   0   0   1   0   0   0   3
46  1   1   1   55  2   4   61  4   0   0   0   1   0   0   2
46  3   3   1   19  2   4   61  4   0   0   0   1   0   0   2
46  2   2   2   54  2   4   61  4   0   0   0   1   0   0   2
46  4   3   2   18  2   4   61  4   0   0   0   1   0   0   2
47  1   1   1   30  2   4   61  1   1   0   0   0   0   0   2
47  2   2   2   30  2   4   61  1   1   0   0   0   0   0   2
48  1   1   1   64  2   4   72  5   0   0   0   0   1   0   3
48  2   2   2   54  2   4   72  5   0   0   0   0   1   0   3
48  3   3   2   23  2   4   72  5   0   0   0   0   1   0   3
49  1   1   1   39  2   4   61  3   0   0   1   0   0   0   2
49  2   2   2   36  2   4   61  3   0   0   1   0   0   0   2
50  1   1   1   63  2   1   72  6   0   0   0   0   0   1   3
50  2   2   2   59  2   1   72  6   0   0   0   0   0   1   3
52  1   1   2   53  2   6   58  5   0   0   0   0   1   0   2
52  2   3   2   26  2   6   58  5   0   0   0   0   1   0   2
53  2   3   1   45  2   1   58  5   0   0   0   0   1   0   2
53  1   1   2   69  2   1   58  5   0   0   0   0   1   0   2
54  1   1   2   55  2   6   58  5   0   0   0   0   1   0   2
54  2   3   2   29  2   6   58  5   0   0   0   0   1   0   2
56  3   3   1   16  2   4   58  4   0   0   0   1   0   0   2
56  1   1   2   45  2   4   58  4   0   0   0   1   0   0   2
56  2   3   2   12  2   4   58  4   0   0   0   1   0   0   2
59  1   1   1   56  2   1   50  5   0   0   0   0   1   0   2
59  3   3   1   29  2   1   50  5   0   0   0   0   1   0   2
59  2   2   2   53  2   1   50  5   0   0   0   0   1   0   2
62  1   1   1   59  2   1   50  5   0   0   0   0   1   0   2
62  2   2   2   54  2   1   50  5   0   0   0   0   1   0   2
62  3   3   2   26  2   1   50  5   0   0   0   0   1   0   2
63  1   1   1   42  2   4   50  3   0   0   1   0   0   0   2
63  3   3   1   10  2   4   50  3   0   0   1   0   0   0   2
63  2   2   2   37  2   4   50  3   0   0   1   0   0   0   2
64  1   1   1   31  2   6   50  2   0   1   0   0   0   0   2
64  2   2   2   33  2   6   50  2   0   1   0   0   0   0   2
65  1   1   1   60  2   1   50  5   0   0   0   0   1   0   2
65  3   3   1   27  2   1   50  5   0   0   0   0   1   0   2
65  2   2   2   57  2   1   50  5   0   0   0   0   1   0   2
66  1   1   1   49  2   1   50  5   0   0   0   0   1   0   2
66  2   2   2   54  2   1   50  5   0   0   0   0   1   0   2
66  3   3   2   25  2   1   50  5   0   0   0   0   1   0   2
67  1   1   1   67  2   1   120 6   0   0   0   0   0   1   4
67  2   2   2   65  2   1   120 6   0   0   0   0   0   1   4
68  1   1   1   49  2   4   98  5   0   0   0   0   1   0   3
68  4   3   1   18  2   4   98  5   0   0   0   0   1   0   3
68  2   2   2   48  2   4   98  5   0   0   0   0   1   0   3
68  3   3   2   20  2   4   98  5   0   0   0   0   1   0   3
70  1   1   1   66  2   1   101 6   0   0   0   0   0   1   4
70  2   2   2   56  2   1   101 6   0   0   0   0   0   1   4
71  1   1   1   37  2   2   101 2   0   1   0   0   0   0   4
71  2   2   2   37  2   2   101 2   0   1   0   0   0   0   4
72  1   1   1   74  1   1   91  5   0   0   0   0   1   0   3
72  3   3   1   41  1   1   91  5   0   0   0   0   1   0   3
72  2   2   2   71  1   1   91  5   0   0   0   0   1   0   3
73  1   1   1   60  1   1   91  5   0   0   0   0   1   0   3
73  3   3   1   27  1   1   91  5   0   0   0   0   1   0   3
73  2   2   2   57  1   1   91  5   0   0   0   0   1   0   3
74  1   1   1   61  2   1   119 5   0   0   0   0   1   0   4
74  4   3   1   30  2   1   119 5   0   0   0   0   1   0   4
74  2   2   2   56  2   1   119 5   0   0   0   0   1   0   4
74  3   3   2   32  2   1   119 5   0   0   0   0   1   0   4
75  2   2   1   72  1   1   99  6   0   0   0   0   0   1   3
75  1   1   2   71  1   1   99  6   0   0   0   0   0   1   3
78  1   1   2   28  1   4   15  1   1   0   0   0   0   0   1
80  1   1   1   68  1   1   92  6   0   0   0   0   0   1   3
80  2   2   2   66  1   1   92  6   0   0   0   0   0   1   3
81  2   3   1   27  1   6   46  5   0   0   0   0   1   0   2
81  3   3   1   29  1   6   46  5   0   0   0   0   1   0   2
81  1   1   2   57  1   6   46  5   0   0   0   0   1   0   2
83  1   1   1   30  1   4   43  2   0   1   0   0   0   0   2
83  2   2   2   30  1   4   43  2   0   1   0   0   0   0   2
84  1   1   2   64  1   4   33  6   0   0   0   0   0   1   2
85  1   1   1   35  1   6   26  2   0   1   0   0   0   0   1
85  2   2   2   33  1   6   26  2   0   1   0   0   0   0   1
88  1   1   1   52  2   1   145 5   0   0   0   0   1   0   5
88  2   2   2   49  2   1   145 5   0   0   0   0   1   0   5
88  3   3   2   25  2   1   145 5   0   0   0   0   1   0   5
89  2   3   1   13  2   1   145 4   0   0   0   1   0   0   5
89  3   3   1   22  2   1   145 4   0   0   0   1   0   0   5
89  1   1   2   47  2   1   145 4   0   0   0   1   0   0   5
90  1   1   1   57  2   1   83  5   0   0   0   0   1   0   3
90  3   3   1   25  2   1   83  5   0   0   0   0   1   0   3
90  4   3   1   23  2   1   83  5   0   0   0   0   1   0   3
90  2   2   2   52  2   1   83  5   0   0   0   0   1   0   3
91  1   1   1   33  2   4   83  2   0   1   0   0   0   0   3
91  2   2   2   32  2   4   83  2   0   1   0   0   0   0   3
92  1   1   1   35  2   1   83  3   0   0   1   0   0   0   3
92  2   2   2   34  2   1   83  3   0   0   1   0   0   0   3
93  1   1   1   35  2   4   83  2   0   1   0   0   0   0   3
93  2   2   2   35  2   4   83  2   0   1   0   0   0   0   3
94  1   1   1   55  2   4   83  5   0   0   0   0   1   0   3
94  2   2   2   53  2   4   83  5   0   0   0   0   1   0   3
94  3   3   2   27  2   4   83  5   0   0   0   0   1   0   3
94  4   3   2   24  2   4   83  5   0   0   0   0   1   0   3
95  1   1   1   49  2   1   83  4   0   0   0   1   0   0   3
95  2   3   1   21  2   1   83  4   0   0   0   1   0   0   3
95  3   3   2   15  2   1   83  4   0   0   0   1   0   0   3
96  1   1   1   35  2   1   83  1   1   0   0   0   0   0   3
96  2   2   2   35  2   1   83  1   1   0   0   0   0   0   3
97  1   1   1   54  2   1   83  4   0   0   0   1   0   0   3
97  4   3   1   13  2   1   83  4   0   0   0   1   0   0   3
97  2   2   2   51  2   1   83  4   0   0   0   1   0   0   3
97  3   3   2   21  2   1   83  4   0   0   0   1   0   0   3
98  1   1   1   49  4   1   85  4   0   0   0   1   0   0   3
98  2   2   2   42  4   1   85  4   0   0   0   1   0   0   3
98  3   3   2   20  4   1   85  4   0   0   0   1   0   0   3
98  4   3   2   17  4   1   85  4   0   0   0   1   0   0   3
99  1   1   1   69  4   1   96  6   0   0   0   0   0   1   3
99  2   2   2   66  4   1   96  6   0   0   0   0   0   1   3
100 1   1   1   69  4   1   96  6   0   0   0   0   0   1   3
100 2   2   2   60  4   1   96  6   0   0   0   0   0   1   3
101 1   1   1   32  4   4   33  1   1   0   0   0   0   0   2
101 2   2   2   32  4   4   33  1   1   0   0   0   0   0   2
103 1   1   1   39  1   6   27  4   0   0   0   1   0   0   1
103 2   2   2   34  1   6   27  4   0   0   0   1   0   0   1
103 3   3   2   13  1   6   27  4   0   0   0   1   0   0   1
105 2   3   1   19  1   6   27  5   0   0   0   0   1   0   1
105 3   3   1   25  1   6   27  5   0   0   0   0   1   0   1
105 1   1   2   49  1   6   27  5   0   0   0   0   1   0   1
106 1   1   1   28  1   6   23  1   1   0   0   0   0   0   1
107 1   1   1   49  2   1   78  5   0   0   0   0   1   0   3
107 3   3   1   18  2   1   78  5   0   0   0   0   1   0   3
107 4   3   1   21  2   1   78  5   0   0   0   0   1   0   3
107 2   2   2   49  2   1   78  5   0   0   0   0   1   0   3
108 1   1   1   33  2   4   78  1   1   0   0   0   0   0   3
108 2   2   2   28  2   4   78  1   1   0   0   0   0   0   3
109 1   1   1   55  2   1   78  5   0   0   0   0   1   0   3
109 3   3   1   21  2   1   78  5   0   0   0   0   1   0   3
109 2   2   2   53  2   1   78  5   0   0   0   0   1   0   3
110 1   1   1   48  2   1   78  4   0   0   0   1   0   0   3
110 2   2   2   45  2   1   78  4   0   0   0   1   0   0   3
110 3   3   2   20  2   1   78  4   0   0   0   1   0   0   3
110 4   3   2   15  2   1   78  4   0   0   0   1   0   0   3
111 1   1   1   37  2   4   78  2   0   1   0   0   0   0   3
111 2   2   2   34  2   4   78  2   0   1   0   0   0   0   3
112 1   1   1   28  4   4   82  2   0   1   0   0   0   0   3
112 2   2   2   30  4   4   82  2   0   1   0   0   0   0   3
113 1   1   1   64  4   1   63  5   0   0   0   0   1   0   2
113 3   3   1   26  4   1   63  5   0   0   0   0   1   0   2
113 2   2   2   55  4   1   63  5   0   0   0   0   1   0   2
113 4   3   2   24  4   1   63  5   0   0   0   0   1   0   2
115 1   1   1   42  4   4   58  3   0   0   1   0   0   0   2
115 4   3   1   10  4   4   58  3   0   0   1   0   0   0   2
115 2   2   2   39  4   4   58  3   0   0   1   0   0   0   2
115 3   3   2   12  4   4   58  3   0   0   1   0   0   0   2
116 1   1   1   56  4   1   63  5   0   0   0   0   1   0   2
116 3   3   1   29  4   1   63  5   0   0   0   0   1   0   2
116 2   2   2   51  4   1   63  5   0   0   0   0   1   0   2
118 1   1   1   75  4   1   70  6   0   0   0   0   0   1   3
118 2   2   2   74  4   1   70  6   0   0   0   0   0   1   3
119 1   1   1   49  1   4   66  4   0   0   0   1   0   0   2
119 3   3   1   18  1   4   66  4   0   0   0   1   0   0   2
119 4   3   1   17  1   4   66  4   0   0   0   1   0   0   2
119 2   2   2   47  1   4   66  4   0   0   0   1   0   0   2
120 2   3   1   32  4   1   56  5   0   0   0   0   1   0   2
120 1   1   2   64  4   1   56  5   0   0   0   0   1   0   2
120 3   3   2   41  4   1   56  5   0   0   0   0   1   0   2
121 1   1   1   44  4   4   56  4   0   0   0   1   0   0   2
121 3   3   1   17  4   4   56  4   0   0   0   1   0   0   2
121 4   3   1   16  4   4   56  4   0   0   0   1   0   0   2
121 2   2   2   42  4   4   56  4   0   0   0   1   0   0   2
123 1   1   1   44  4   4   56  3   0   0   1   0   0   0   2
123 2   2   2   43  4   4   56  3   0   0   1   0   0   0   2
123 3   3   2   11  4   4   56  3   0   0   1   0   0   0   2
123 5   3   2   14  4   4   56  3   0   0   1   0   0   0   2
125 2   3   1   21  1   4   30  5   0   0   0   0   1   0   1
125 1   1   2   48  1   4   30  5   0   0   0   0   1   0   1
126 1   1   1   49  1   4   30  5   0   0   0   0   1   0   1
126 2   2   2   44  1   4   30  5   0   0   0   0   1   0   1
126 3   3   2   25  1   4   30  5   0   0   0   0   1   0   1
127 1   1   1   75  1   6   25  6   0   0   0   0   0   1   1
128 1   1   1   49  2   1   82  3   0   0   1   0   0   0   3
128 3   3   1   12  2   1   82  3   0   0   1   0   0   0   3
128 2   2   2   43  2   1   82  3   0   0   1   0   0   0   3
129 1   1   2   66  2   1   82  6   0   0   0   0   0   1   3
130 1   1   1   36  2   4   82  3   0   0   1   0   0   0   3
130 2   2   2   41  2   4   82  3   0   0   1   0   0   0   3
130 3   3   2   11  2   4   82  3   0   0   1   0   0   0   3
132 1   1   2   64  2   1   82  6   0   0   0   0   0   1   3
133 1   1   1   34  2   1   82  2   0   1   0   0   0   0   3
133 2   2   2   35  2   1   82  2   0   1   0   0   0   0   3
134 1   1   1   37  2   4   82  2   0   1   0   0   0   0   3
134 2   2   2   35  2   4   82  2   0   1   0   0   0   0   3
135 1   1   1   38  2   4   82  2   0   1   0   0   0   0   3
135 2   2   2   37  2   4   82  2   0   1   0   0   0   0   3
136 1   1   1   31  2   6   83  1   1   0   0   0   0   0   3
136 2   2   2   29  2   6   83  1   1   0   0   0   0   0   3
137 2   2   1   47  2   5   30  3   0   0   1   0   0   0   1
137 3   3   1   19  2   5   30  3   0   0   1   0   0   0   1
137 1   1   2   43  2   5   30  3   0   0   1   0   0   0   1
137 4   3   2   10  2   5   30  3   0   0   1   0   0   0   1
138 2   3   1   24  2   5   30  5   0   0   0   0   1   0   1
138 1   1   2   54  2   5   30  5   0   0   0   0   1   0   1
139 1   1   2   44  2   5   30  4   0   0   0   1   0   0   1
139 2   3   2   13  2   5   30  4   0   0   0   1   0   0   1
139 3   3   2   15  2   5   30  4   0   0   0   1   0   0   1
140 1   1   2   55  2   5   30  5   0   0   0   0   1   0   1
140 2   3   2   29  2   5   30  5   0   0   0   0   1   0   1
141 1   1   1   45  2   5   30  4   0   0   0   1   0   0   1
141 2   2   2   43  2   5   30  4   0   0   0   1   0   0   1
141 3   3   2   15  2   5   30  4   0   0   0   1   0   0   1
141 4   3   2   13  2   5   30  4   0   0   0   1   0   0   1
142 1   1   2   52  2   5   30  4   0   0   0   1   0   0   1
142 2   3   2   23  2   5   30  4   0   0   0   1   0   0   1
142 3   3   2   18  2   5   30  4   0   0   0   1   0   0   1
144 1   1   1   52  2   5   30  5   0   0   0   0   1   0   1
144 4   3   1   19  2   5   30  5   0   0   0   0   1   0   1
144 2   2   2   48  2   5   30  5   0   0   0   0   1   0   1
144 3   3   2   22  2   5   30  5   0   0   0   0   1   0   1
145 1   1   1   61  2   4   72  6   0   0   0   0   0   1   3
145 2   2   2   55  2   4   72  6   0   0   0   0   0   1   3
147 1   1   1   32  2   4   85  1   1   0   0   0   0   0   3
147 2   2   2   33  2   4   85  1   1   0   0   0   0   0   3
148 1   1   1   30  2   1   85  1   1   0   0   0   0   0   3
148 2   2   2   35  2   1   85  1   1   0   0   0   0   0   3
149 2   2   1   54  1   1   46  4   0   0   0   1   0   0   2
149 1   1   2   51  1   1   46  4   0   0   0   1   0   0   2
149 3   3   2   20  1   1   46  4   0   0   0   1   0   0   2
149 4   3   2   13  1   1   46  4   0   0   0   1   0   0   2
149 5   3   2   27  1   1   46  4   0   0   0   1   0   0   2
152 1   1   1   72  1   1   99  5   0   0   0   0   1   0   3
152 3   3   1   39  1   1   99  5   0   0   0   0   1   0   3
152 2   2   2   69  1   1   99  5   0   0   0   0   1   0   3
153 1   1   1   28  1   6   49  2   0   1   0   0   0   0   2
153 2   2   2   27  1   6   49  2   0   1   0   0   0   0   2
155 1   1   2   54  1   6   27  5   0   0   0   0   1   0   1
155 2   3   2   29  1   6   27  5   0   0   0   0   1   0   1
156 1   1   1   48  1   1   76  3   0   0   1   0   0   0   3
156 3   3   1   17  1   1   76  3   0   0   1   0   0   0   3
156 2   2   2   43  1   1   76  3   0   0   1   0   0   0   3
158 1   1   1   52  1   4   50  5   0   0   0   0   1   0   2
158 3   3   1   23  1   4   50  5   0   0   0   0   1   0   2
158 2   2   2   47  1   4   50  5   0   0   0   0   1   0   2
158 4   3   2   20  1   4   50  5   0   0   0   0   1   0   2
159 1   1   1   54  1   6   40  5   0   0   0   0   1   0   2
159 3   3   1   30  1   6   40  5   0   0   0   0   1   0   2
159 2   2   2   51  1   6   40  5   0   0   0   0   1   0   2
159 4   3   2   28  1   6   40  5   0   0   0   0   1   0   2
160 1   1   1   35  1   4   36  2   0   1   0   0   0   0   2
160 2   2   2   34  1   4   36  2   0   1   0   0   0   0   2
162 1   1   1   74  1   1   76  6   0   0   0   0   0   1   3
162 2   2   2   74  1   1   76  6   0   0   0   0   0   1   3
163 3   3   1   16  1   4   40  4   0   0   0   1   0   0   2
163 1   1   2   44  1   4   40  4   0   0   0   1   0   0   2
163 2   3   2   20  1   4   40  4   0   0   0   1   0   0   2
165 1   1   1   72  2   1   114 6   0   0   0   0   0   1   4
165 2   2   2   69  2   1   114 6   0   0   0   0   0   1   4
166 1   1   1   59  2   4   114 5   0   0   0   0   1   0   4
166 3   3   1   26  2   4   114 5   0   0   0   0   1   0   4
166 2   2   2   54  2   4   114 5   0   0   0   0   1   0   4
166 4   3   2   28  2   4   114 5   0   0   0   0   1   0   4
168 1   1   1   55  2   1   114 5   0   0   0   0   1   0   4
168 3   3   1   28  2   1   114 5   0   0   0   0   1   0   4
168 2   2   2   49  2   1   114 5   0   0   0   0   1   0   4
168 4   3   2   26  2   1   114 5   0   0   0   0   1   0   4
171 1   1   1   57  2   1   114 5   0   0   0   0   1   0   4
171 3   3   1   26  2   1   114 5   0   0   0   0   1   0   4
171 2   2   2   50  2   1   114 5   0   0   0   0   1   0   4
172 1   1   1   58  2   1   114 5   0   0   0   0   1   0   4
172 3   3   1   22  2   1   114 5   0   0   0   0   1   0   4
172 4   3   1   25  2   1   114 5   0   0   0   0   1   0   4
172 2   2   2   53  2   1   114 5   0   0   0   0   1   0   4
172 5   3   2   27  2   1   114 5   0   0   0   0   1   0   4
173 1   1   1   45  3   4   59  3   0   0   1   0   0   0   2
173 3   3   1   12  3   4   59  3   0   0   1   0   0   0   2
173 2   2   2   33  3   4   59  3   0   0   1   0   0   0   2
174 1   1   2   80  3   1   59  6   0   0   0   0   0   1   2
175 1   1   1   71  3   1   59  5   0   0   0   0   1   0   2
175 2   2   2   67  3   1   59  5   0   0   0   0   1   0   2
175 3   3   2   28  3   1   59  5   0   0   0   0   1   0   2
176 1   1   1   55  3   1   59  4   0   0   0   1   0   0   2
176 3   3   1   25  3   1   59  4   0   0   0   1   0   0   2
176 2   2   2   50  3   1   59  4   0   0   0   1   0   0   2
176 4   3   2   17  3   1   59  4   0   0   0   1   0   0   2
178 2   2   1   60  3   1   59  5   0   0   0   0   1   0   2
178 3   3   1   26  3   1   59  5   0   0   0   0   1   0   2
178 4   3   1   23  3   1   59  5   0   0   0   0   1   0   2
178 1   1   2   50  3   1   59  5   0   0   0   0   1   0   2
179 1   1   1   52  3   1   59  4   0   0   0   1   0   0   2
179 3   3   1   18  3   1   59  4   0   0   0   1   0   0   2
179 2   2   2   43  3   1   59  4   0   0   0   1   0   0   2
179 4   3   2   17  3   1   59  4   0   0   0   1   0   0   2
180 1   1   1   60  3   1   59  5   0   0   0   0   1   0   2
180 3   3   1   27  3   1   59  5   0   0   0   0   1   0   2
180 2   2   2   60  3   1   59  5   0   0   0   0   1   0   2
182 1   1   2   47  4   1   53  3   0   0   1   0   0   0   2
182 2   3   2   10  4   1   53  3   0   0   1   0   0   0   2
184 1   1   1   36  4   4   59  2   0   1   0   0   0   0   2
184 2   2   2   38  4   4   59  2   0   1   0   0   0   0   2
185 1   1   1   43  4   1   59  3   0   0   1   0   0   0   2
185 3   3   1   15  4   1   59  3   0   0   1   0   0   0   2
185 4   3   1   11  4   1   59  3   0   0   1   0   0   0   2
185 2   2   2   41  4   1   59  3   0   0   1   0   0   0   2
186 1   1   1   36  4   1   50  2   0   1   0   0   0   0   2
186 2   2   2   32  4   1   50  2   0   1   0   0   0   0   2
186 5   3   2   10  4   1   50  2   0   1   0   0   0   0   2
187 1   1   2   55  4   1   53  5   0   0   0   0   1   0   2
187 2   3   2   25  4   1   53  5   0   0   0   0   1   0   2
187 3   3   2   27  4   1   53  5   0   0   0   0   1   0   2
188 1   1   1   67  4   1   53  6   0   0   0   0   0   1   2
188 2   2   2   64  4   1   53  6   0   0   0   0   0   1   2
189 1   1   1   69  4   1   50  5   0   0   0   0   1   0   2
189 3   3   1   34  4   1   50  5   0   0   0   0   1   0   2
189 2   2   2   57  4   1   50  5   0   0   0   0   1   0   2
190 1   1   1   62  4   1   50  5   0   0   0   0   1   0   2
190 3   3   1   27  4   1   50  5   0   0   0   0   1   0   2
190 2   2   2   55  4   1   50  5   0   0   0   0   1   0   2
191 1   1   1   38  3   1   54  2   0   1   0   0   0   0   2
191 2   2   2   36  3   1   54  2   0   1   0   0   0   0   2
192 1   1   2   69  3   4   54  6   0   0   0   0   0   1   2
193 1   1   1   58  3   4   54  5   0   0   0   0   1   0   2
193 3   3   1   27  3   4   54  5   0   0   0   0   1   0   2
193 4   3   1   24  3   4   54  5   0   0   0   0   1   0   2
193 2   2   2   50  3   4   54  5   0   0   0   0   1   0   2
194 1   1   1   77  3   1   54  6   0   0   0   0   0   1   2
194 2   2   2   77  3   1   54  6   0   0   0   0   0   1   2
196 1   1   1   63  4   1   73  5   0   0   0   0   1   0   3
196 3   3   1   37  4   1   73  5   0   0   0   0   1   0   3
196 4   3   1   33  4   1   73  5   0   0   0   0   1   0   3
196 2   2   2   62  4   1   73  5   0   0   0   0   1   0   3
197 1   1   1   66  4   1   73  6   0   0   0   0   0   1   3
197 2   2   2   59  4   1   73  6   0   0   0   0   0   1   3
198 1   1   1   52  4   1   73  3   0   0   1   0   0   0   3
198 3   3   1   13  4   1   73  3   0   0   1   0   0   0   3
198 2   2   2   47  4   1   73  3   0   0   1   0   0   0   3
198 4   3   2   12  4   1   73  3   0   0   1   0   0   0   3
199 1   1   1   43  4   4   73  3   0   0   1   0   0   0   3
199 2   2   2   41  4   4   73  3   0   0   1   0   0   0   3
199 3   3   2   11  4   4   73  3   0   0   1   0   0   0   3
200 2   3   1   26  4   1   73  5   0   0   0   0   1   0   3
200 3   3   1   28  4   1   73  5   0   0   0   0   1   0   3
200 1   1   2   53  4   1   73  5   0   0   0   0   1   0   3
201 1   1   1   53  4   1   73  5   0   0   0   0   1   0   3
201 3   3   1   27  4   1   73  5   0   0   0   0   1   0   3
201 2   2   2   50  4   1   73  5   0   0   0   0   1   0   3
202 1   1   1   77  4   1   73  5   0   0   0   0   1   0   3
202 3   3   1   35  4   1   73  5   0   0   0   0   1   0   3
202 2   2   2   60  4   1   73  5   0   0   0   0   1   0   3
204 1   1   1   56  4   1   53  5   0   0   0   0   1   0   2
204 2   2   2   53  4   1   53  5   0   0   0   0   1   0   2
204 3   3   2   22  4   1   53  5   0   0   0   0   1   0   2
205 1   1   1   60  4   4   66  5   0   0   0   0   1   0   2
205 3   3   1   29  4   4   66  5   0   0   0   0   1   0   2
205 4   3   1   27  4   4   66  5   0   0   0   0   1   0   2
205 2   2   2   56  4   4   66  5   0   0   0   0   1   0   2
206 1   1   1   67  4   1   76  6   0   0   0   0   0   1   3
206 2   2   2   67  4   1   76  6   0   0   0   0   0   1   3
208 1   1   1   46  4   1   66  4   0   0   0   1   0   0   2
208 4   3   1   14  4   1   66  4   0   0   0   1   0   0   2
208 2   2   2   45  4   1   66  4   0   0   0   1   0   0   2
208 3   3   2   17  4   1   66  4   0   0   0   1   0   0   2
209 1   1   1   42  4   4   56  2   0   1   0   0   0   0   2
209 3   3   1   10  4   4   56  2   0   1   0   0   0   0   2
209 2   2   2   38  4   4   56  2   0   1   0   0   0   0   2
210 3   3   1   12  4   1   56  3   0   0   1   0   0   0   2
210 1   1   2   40  4   1   56  3   0   0   1   0   0   0   2
210 2   3   2   10  4   1   56  3   0   0   1   0   0   0   2
212 1   1   2   37  1   4   63  2   0   1   0   0   0   0   2
214 1   1   1   63  3   1   40  6   0   0   0   0   0   1   2
215 1   1   1   62  3   1   40  5   0   0   0   0   1   0   2
215 3   3   1   28  3   1   40  5   0   0   0   0   1   0   2
215 2   2   2   57  3   1   40  5   0   0   0   0   1   0   2
216 1   1   2   71  3   1   40  6   0   0   0   0   0   1   2
217 1   1   2   49  4   1   40  5   0   0   0   0   1   0   2
217 2   3   2   24  4   1   40  5   0   0   0   0   1   0   2
218 1   1   1   74  1   1   37  6   0   0   0   0   0   1   2
218 2   2   2   67  1   1   37  6   0   0   0   0   0   1   2
220 1   1   1   51  4   4   66  4   0   0   0   1   0   0   2
220 4   3   1   13  4   4   66  4   0   0   0   1   0   0   2
220 5   3   1   18  4   4   66  4   0   0   0   1   0   0   2
220 2   2   2   49  4   4   66  4   0   0   0   1   0   0   2
220 3   3   2   16  4   4   66  4   0   0   0   1   0   0   2
221 1   1   2   81  1   6   40  6   0   0   0   0   0   1   2
222 1   1   1   45  2   1   85  3   0   0   1   0   0   0   3
222 4   3   1   10  2   1   85  3   0   0   1   0   0   0   3
222 2   2   2   41  2   1   85  3   0   0   1   0   0   0   3
222 3   3   2   15  2   1   85  3   0   0   1   0   0   0   3
223 1   1   2   51  2   1   85  5   0   0   0   0   1   0   3
223 2   3   2   25  2   1   85  5   0   0   0   0   1   0   3
224 2   3   1   12  2   4   85  4   0   0   0   1   0   0   3
224 1   1   2   47  2   4   85  4   0   0   0   1   0   0   3
224 3   3   2   18  2   4   85  4   0   0   0   1   0   0   3
225 1   1   1   68  2   1   85  6   0   0   0   0   0   1   3
225 2   2   2   67  2   1   85  6   0   0   0   0   0   1   3
226 1   1   1   50  2   1   85  4   0   0   0   1   0   0   3
226 4   3   1   17  2   1   85  4   0   0   0   1   0   0   3
226 2   2   2   46  2   1   85  4   0   0   0   1   0   0   3
226 3   3   2   19  2   1   85  4   0   0   0   1   0   0   3
229 2   2   1   67  2   1   85  5   0   0   0   0   1   0   3
229 1   1   2   57  2   1   85  5   0   0   0   0   1   0   3
229 3   3   2   37  2   1   85  5   0   0   0   0   1   0   3
232 1   1   1   54  2   1   86  5   0   0   0   0   1   0   3
232 2   2   2   53  2   1   86  5   0   0   0   0   1   0   3
232 3   3   2   29  2   1   86  5   0   0   0   0   1   0   3
233 1   1   1   57  2   1   86  5   0   0   0   0   1   0   3
233 2   2   2   52  2   1   86  5   0   0   0   0   1   0   3
233 3   3   2   24  2   1   86  5   0   0   0   0   1   0   3
235 1   1   2   51  2   1   86  3   0   0   1   0   0   0   3
236 1   1   1   41  2   4   86  2   0   1   0   0   0   0   3
236 5   3   1   12  2   4   86  2   0   1   0   0   0   0   3
236 2   2   2   39  2   4   86  2   0   1   0   0   0   0   3
236 3   3   2   10  2   4   86  2   0   1   0   0   0   0   3
237 1   1   1   48  2   1   86  4   0   0   0   1   0   0   3
237 2   2   2   48  2   1   86  4   0   0   0   1   0   0   3
237 3   3   2   20  2   1   86  4   0   0   0   1   0   0   3
237 4   3   2   16  2   1   86  4   0   0   0   1   0   0   3
238 1   1   2   53  4   1   50  5   0   0   0   0   1   0   2
238 2   3   2   29  4   1   50  5   0   0   0   0   1   0   2
240 2   3   1   31  4   1   50  5   0   0   0   0   1   0   2
240 1   1   2   61  4   1   50  5   0   0   0   0   1   0   2
241 2   3   1   24  4   1   50  5   0   0   0   0   1   0   2
241 1   1   2   51  4   1   50  5   0   0   0   0   1   0   2
242 1   1   1   39  4   6   50  3   0   0   1   0   0   0   2
242 3   3   1   11  4   6   50  3   0   0   1   0   0   0   2
242 2   2   2   38  4   6   50  3   0   0   1   0   0   0   2
245 1   1   1   48  4   1   50  4   0   0   0   1   0   0   2
245 3   3   1   17  4   1   50  4   0   0   0   1   0   0   2
245 2   2   2   42  4   1   50  4   0   0   0   1   0   0   2
246 1   1   1   58  5   4   50  5   0   0   0   0   1   0   2
246 2   2   2   50  5   4   50  5   0   0   0   0   1   0   2
246 3   3   2   26  5   4   50  5   0   0   0   0   1   0   2
247 2   2   1   43  4   1   46  3   0   0   1   0   0   0   2
247 1   1   2   41  4   1   46  3   0   0   1   0   0   0   2
247 3   3   2   11  4   1   46  3   0   0   1   0   0   0   2
248 1   1   1   40  4   1   70  1   1   0   0   0   0   0   3
248 2   2   2   32  4   1   70  1   1   0   0   0   0   0   3
249 1   1   1   43  4   1   64  4   0   0   0   1   0   0   2
249 3   3   1   16  4   1   64  4   0   0   0   1   0   0   2
249 2   2   2   41  4   1   64  4   0   0   0   1   0   0   2
249 4   3   2   15  4   1   64  4   0   0   0   1   0   0   2
250 2   2   1   32  4   1   54  1   1   0   0   0   0   0   2
250 1   1   2   30  4   1   54  1   1   0   0   0   0   0   2
251 1   1   1   65  1   1   132 6   0   0   0   0   0   1   4
251 2   2   2   62  1   1   132 6   0   0   0   0   0   1   4
254 1   1   1   37  2   4   85  2   0   1   0   0   0   0   3
254 2   2   2   37  2   4   85  2   0   1   0   0   0   0   3
256 1   1   1   50  2   1   85  4   0   0   0   1   0   0   3
256 2   2   2   47  2   1   85  4   0   0   0   1   0   0   3
256 3   3   2   16  2   1   85  4   0   0   0   1   0   0   3
256 4   3   2   14  2   1   85  4   0   0   0   1   0   0   3
257 1   1   1   46  2   4   85  4   0   0   0   1   0   0   3
257 4   3   1   16  2   4   85  4   0   0   0   1   0   0   3
257 2   2   2   44  2   4   85  4   0   0   0   1   0   0   3
257 3   3   2   19  2   4   85  4   0   0   0   1   0   0   3
259 1   1   1   55  2   1   85  5   0   0   0   0   1   0   3
259 2   2   2   53  2   1   85  5   0   0   0   0   1   0   3
259 3   3   2   31  2   1   85  5   0   0   0   0   1   0   3
261 1   1   1   65  2   1   145 6   0   0   0   0   0   1   5
261 2   2   2   62  2   1   145 6   0   0   0   0   0   1   5
262 1   1   1   44  3   1   56  4   0   0   0   1   0   0   2
262 3   3   1   19  3   1   56  4   0   0   0   1   0   0   2
262 2   2   2   42  3   1   56  4   0   0   0   1   0   0   2
262 4   3   2   15  3   1   56  4   0   0   0   1   0   0   2
263 1   1   1   49  3   1   54  5   0   0   0   0   1   0   2
263 4   3   1   22  3   1   54  5   0   0   0   0   1   0   2
263 2   2   2   47  3   1   54  5   0   0   0   0   1   0   2
263 3   3   2   19  3   1   54  5   0   0   0   0   1   0   2
266 1   1   1   54  3   1   56  5   0   0   0   0   1   0   2
266 3   3   1   29  3   1   56  5   0   0   0   0   1   0   2
266 2   2   2   49  3   1   56  5   0   0   0   0   1   0   2
267 1   1   2   63  3   1   42  6   0   0   0   0   0   1   2
268 1   1   1   45  3   1   43  3   0   0   1   0   0   0   2
268 3   3   1   11  3   1   43  3   0   0   1   0   0   0   2
268 2   2   2   36  3   1   43  3   0   0   1   0   0   0   2
268 5   3   2   12  3   1   43  3   0   0   1   0   0   0   2
269 1   1   1   45  3   1   47  3   0   0   1   0   0   0   2
269 2   2   2   42  3   1   47  3   0   0   1   0   0   0   2
269 3   3   2   11  3   1   47  3   0   0   1   0   0   0   2
270 1   1   1   34  2   4   59  2   0   1   0   0   0   0   2
270 2   2   2   34  2   4   59  2   0   1   0   0   0   0   2
271 2   2   1   60  2   1   59  5   0   0   0   0   1   0   2
271 3   3   1   34  2   1   59  5   0   0   0   0   1   0   2
271 1   1   2   57  2   1   59  5   0   0   0   0   1   0   2
272 1   1   1   35  2   1   59  2   0   1   0   0   0   0   2
272 2   2   2   35  2   1   59  2   0   1   0   0   0   0   2
273 1   1   1   35  2   1   59  2   0   1   0   0   0   0   2
273 2   2   2   39  2   1   59  2   0   1   0   0   0   0   2
275 1   1   1   33  2   1   59  2   0   1   0   0   0   0   2
275 2   2   2   29  2   1   59  2   0   1   0   0   0   0   2
276 1   1   1   30  2   4   59  1   1   0   0   0   0   0   2
277 1   1   1   47  2   1   59  4   0   0   0   1   0   0   2
277 2   2   2   48  2   1   59  4   0   0   0   1   0   0   2
277 3   3   2   17  2   1   59  4   0   0   0   1   0   0   2
277 4   3   2   15  2   1   59  4   0   0   0   1   0   0   2
278 1   1   1   78  2   1   84  6   0   0   0   0   0   1   3
278 2   2   2   79  2   1   84  6   0   0   0   0   0   1   3
280 1   1   1   56  2   1   84  5   0   0   0   0   1   0   3
280 2   2   2   53  2   1   84  5   0   0   0   0   1   0   3
280 3   3   2   27  2   1   84  5   0   0   0   0   1   0   3
281 1   1   1   50  2   1   84  4   0   0   0   1   0   0   3
281 4   3   1   17  2   1   84  4   0   0   0   1   0   0   3
281 2   2   2   45  2   1   84  4   0   0   0   1   0   0   3
281 3   3   2   22  2   1   84  4   0   0   0   1   0   0   3
283 1   1   1   51  2   1   84  5   0   0   0   0   1   0   3
283 4   3   1   25  2   1   84  5   0   0   0   0   1   0   3
283 2   2   2   49  2   1   84  5   0   0   0   0   1   0   3
283 3   3   2   27  2   1   84  5   0   0   0   0   1   0   3
285 1   1   1   48  2   1   122 3   0   0   1   0   0   0   4
285 5   3   1   17  2   1   122 3   0   0   1   0   0   0   4
285 2   2   2   41  2   1   122 3   0   0   1   0   0   0   4
285 3   3   2   15  2   1   122 3   0   0   1   0   0   0   4
286 1   1   1   57  2   1   122 5   0   0   0   0   1   0   4
286 4   3   1   25  2   1   122 5   0   0   0   0   1   0   4
286 2   2   2   51  2   1   122 5   0   0   0   0   1   0   4
286 3   3   2   29  2   1   122 5   0   0   0   0   1   0   4
287 1   1   1   43  2   1   122 2   0   1   0   0   0   0   4
287 2   2   2   40  2   1   122 2   0   1   0   0   0   0   4
287 3   3   2   12  2   1   122 2   0   1   0   0   0   0   4
290 1   1   1   46  2   1   102 3   0   0   1   0   0   0   4
290 4   3   1   10  2   1   102 3   0   0   1   0   0   0   4
290 2   2   2   42  2   1   102 3   0   0   1   0   0   0   4
290 3   3   2   15  2   1   102 3   0   0   1   0   0   0   4
291 1   1   1   30  2   4   102 2   0   1   0   0   0   0   4
291 2   2   2   26  2   4   102 2   0   1   0   0   0   0   4
292 1   1   2   61  1   1   59  6   0   0   0   0   0   1   2
295 1   1   1   47  1   4   43  3   0   0   1   0   0   0   2
295 3   3   1   11  1   4   43  3   0   0   1   0   0   0   2
295 2   2   2   43  1   4   43  3   0   0   1   0   0   0   2
297 1   1   1   43  1   4   43  2   0   1   0   0   0   0   2
297 2   2   2   46  1   4   43  2   0   1   0   0   0   0   2
298 1   1   1   40  1   4   56  2   0   1   0   0   0   0   2
298 2   2   2   37  1   4   56  2   0   1   0   0   0   0   2
299 2   3   1   24  1   4   50  5   0   0   0   0   1   0   2
299 1   1   2   60  1   4   50  5   0   0   0   0   1   0   2
300 1   1   1   46  4   4   83  4   0   0   0   1   0   0   3
300 2   2   2   43  4   4   83  4   0   0   0   1   0   0   3
300 3   3   2   13  4   4   83  4   0   0   0   1   0   0   3
4

1 回答 1

0

我的理解是 R 被实现为写时复制。

举个例子:

X <- 1:1000
y <- x      # no copy made. x & y share the reference
y[1] <- 8   # now a copy is made.

如果 x 正在增长,则副本需要的时间会越来越长,并且脚本会变慢。我对宏变量不太熟悉,但我怀疑这样的事情正在发生。如果您正在使用列表,则每次向列表中添加新元素时,都会重新复制所有内容。

y <- list()
y$this <- 1:5
y$that <- 6:10  # now every thing was recopied.

因此最好先分配。它确实有助于性能。

y <- vector("list", 2)
y[[1]] <- 1:5
y[[2]] <- 6:10

这些幻灯片真的很棒:一个链接看看!

于 2012-05-24T04:03:48.767 回答