Browse Source

Save an rds file of all models

Petra Lamborn 5 years ago
parent
commit
e30e28a747
2 changed files with 16 additions and 1 deletions
  1. 2
    1
      .gitignore
  2. 14
    0
      R/combmodels.R

+ 2
- 1
.gitignore View File

@@ -1,5 +1,6 @@
1
-# Ignore data folder completely
1
+# Ignore data, model folder completely
2 2
 data/
3
+models/
3 4
 
4 5
 # ---> Python
5 6
 # Byte-compiled / optimized / DLL files

+ 14
- 0
R/combmodels.R View File

@@ -130,3 +130,17 @@ ocdf <- p$read_pickle('../data/9-clusters-sample-table.pkl')
130 130
 ncdf <- p$read_pickle('../data/1617-asgn-table.pkl')
131 131
 table(ocdf$cluster)
132 132
 table(ncdf$cluster)
133
+
134
+
135
+allmods <- list()
136
+
137
+for (clus in clusters) {
138
+    clusdf <- filter(aggdf, cluster == clus) %>% 
139
+        dplyr::select(read_time, kwh = kwh_tot_mean) %>% 
140
+        left_join(mtempdf, by = "read_time") %>% cbind(harm.y, harm.w, harm.d)
141
+    largm <- lm(nform.comp, data = clusdf, model = FALSE, qr = FALSE)
142
+    allmods[[clus]] <- largm
143
+}
144
+
145
+saveRDS(allmods, '../models/1kmods.rds')
146
+