This notebook shows how to deal with irregular functional data by analyzing the dataset CD4 cell count. """ # Author: Steven Golovkine <*****@*****.**> # License: MIT # shinx_gallery_thumbnail_number = 2 from FDApy.misc.loader import read_csv from FDApy.visualization.plot import plot ############################################################################### # Load the data into Pandas dataframe. cd4 = read_csv('./data/cd4.csv', index_col=0) ############################################################################### # Print out an Irregular Functional data object. # Print irregular functional data print(cd4) ############################################################################### # The sampling points of the data can easily be accessed. # Accessing the argvals of the object print(cd4.argvals['input_dim_0'].get(5)) ############################################################################### # The values associated to the sampling points are retrieved in a same way
This notebook shows how to deal with univariate and multivariate functional data by analyzing the canadian weather dataset. """ # Author: Steven Golovkine <*****@*****.**> # License: MIT # shinx_gallery_thumbnail_number = 2 from FDApy.representation.functional_data import MultivariateFunctionalData from FDApy.misc.loader import read_csv from FDApy.visualization.plot import plot ############################################################################### # Load the data as DenseFunctionalData. precipitation = read_csv('./data/canadian_precipitation_monthly.csv', index_col=0) temperature = read_csv('./data/canadian_temperature_daily.csv', index_col=0) # Create multivariate functional data for the Canadian weather data. canadWeather = MultivariateFunctionalData([precipitation, temperature]) ############################################################################### # Print out an univariate functional data object. # Print univariate functional data print(temperature) ############################################################################### # Print out a multivariate functional data object. # Print multivariate functional data
def test_load_irregular(self): data = read_csv(os.path.join(DATA, 'irregular.csv'), index_col=0) self.assertEqual(data.n_dim, 1) self.assertEqual(data.n_obs, 3) self.assertTrue(np.allclose(data.argvals['input_dim_0'][0], np.array([-2, 0, 3])))
""" # Author: Steven Golovkine <*****@*****.**> # License: MIT # shinx_gallery_thumbnail_number = 2 import pandas as pd from FDApy.preprocessing.dim_reduction.fpca import UFPCA from FDApy.visualization.plot import plot from FDApy.misc.loader import read_csv ############################################################################### # Load the data into Pandas dataframe temperature = read_csv('./data/canadian_temperature_daily.csv', index_col=0) ############################################################################### # Perform a univariate functional PCA and explore the results. # Perform a univariate FPCA on dailyTemp. fpca = UFPCA(n_components=0.99) fpca.fit(temperature) # Plot the results of the FPCA (eigenfunctions) _ = plot(fpca.eigenfunctions) ############################################################################### # Compute the scores of the dailyTemp data into the eigenfunctions basis using # numerical integration.
def test_load_dense(self): data = read_csv(os.path.join(DATA, 'dense.csv'), index_col=0) self.assertEqual(data.n_dim, 1) self.assertEqual(data.n_obs, 3) self.assertTrue(np.allclose(data.argvals['input_dim_0'], np.array([0, 1, 2, 3])))