Example #1
0
    def visualize_predictions(self, X, M, title=None):
        """Visualize the predicted probabilities for each of the missing pixels."""

        P = self.posterior_predictive_means(X, M)
        imgs = np.where(M, X, P)
        obs = np.where(M, X, 0.3)

        pylab.figure('Observations')
        pylab.matshow(util.arrange(obs.reshape((-1, IMAGE_DIM, IMAGE_DIM))),
                      fignum=False, cmap='gray')
        pylab.title('Observations')

        pylab.figure('Model predictions')
        pylab.matshow(util.arrange(imgs.reshape((-1, IMAGE_DIM, IMAGE_DIM))),
                      fignum=False, cmap='gray')
        if title is None:
            title = 'Model predictions'
        pylab.title(title)
        pylab.draw()
Example #2
0
    def visualize_components(self, title=None):
        """Visualize the learned components. Each of the images shows the Bernoulli parameters
        (probability of the pixel being 1) for one of the mixture components."""

        pylab.figure('Mixture components')
        pylab.matshow(util.arrange(self.params.theta.reshape((-1, IMAGE_DIM, IMAGE_DIM))),
                      fignum=False, cmap='gray')
        if title is None:
            title = 'Mixture components'
        pylab.title(title)
        pylab.draw()
Example #3
0
diffcoef_img_path = os.path.join(results_path, 'diffcoef')

##########################################################################

#dpi設定
fine = 300
pylab.figure(figsize=(10, 4), dpi=fine)

#W0時点の乾燥時間dtを定義
dt = 1 * np.exp(-9223372036854775808)

#  重量測定をcsvファイルから読み込み
rawdata_df = pd.read_csv(rawdata_path)

#csvファイルから読み込んだデータを編集(dataframe : data_df)
util.arrange(rawdata_df, dt)
data_df, groups, days, weight = util.arrange(rawdata_df, dt)
data_df = data_df.dropna()

#legendを設定
legends_dict = util.make_legends(group_data)


def watercontent(data_df, days, color, legends_dict):
    watercontent_df = pd.DataFrame(index=days, columns=groups)
    for group in groups:

        df = pd.DataFrame(index=days, columns=['ratio'])

        for i in days:
            # 乾燥日数ごとに平均の含水率算出