You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I am wondering if there's an example of combining multi-classification and regression problem into linear coregionalization model? My input features are 2 dimensional output is 1D regression + 1D 3-classes categories.
My problem is defined as:
I am wondering if there is a way we can combine multi-class classification with regression. I probably need to write a CategoricalLikelihood().
My input features are 2 dimensional output is 1D regression + 1D 3-classes categories.
My current code is:
Hi I am wondering if there's an example of combining multi-classification and regression problem into linear coregionalization model? My input features are 2 dimensional output is 1D regression + 1D 3-classes categories.
My problem is defined as:
I am wondering if there is a way we can combine multi-class classification with regression. I probably need to write a CategoricalLikelihood().
My input features are 2 dimensional output is 1D regression + 1D 3-classes categories.
My current code is:
np.random.seed(42)
n_samples = 100
X1 = np.random.rand(n_samples) * 10
X2 = np.random.rand(n_samples) * 10
y_regression = 3 * X1 + 2 * X2 + np.random.randn(n_samples) * 2
y_classification = np.digitize(y_regression, bins=[-np.inf, 10, 25, np.inf]) - 1
y_classification = y_classification.astype(int)
y_regression = np.array([2.5 if label == 0 else 0.5 if label == 1 else 1.5 for label in y_classification])+np.random.randn(n_samples) * 2 *0.1
plt.figure(figsize=(4, 3))
plt.scatter(X1,X2, c=y_regression)
plt.title('Regression')
plt.colorbar()
plt.figure(figsize=(4, 3))
plt.scatter(X1,X2, c=y_classification)
plt.title('Classification')
X = np.hstack([X1[:,None], X2[:,None]])
y = np.hstack([y_regression[:,None], y_classification[:,None]])
X_train = torch.from_numpy(X).float()
y_train=torch.tensor(y)
num_latents = X_train.shape[1]
num_tasks = y_train.shape[1]
num_classes= 3
I have referred to some discussion and examples, still quite not sure where I should start.
#1396
https://github.com/cornellius-gp/gpytorch/blob/main/examples/03_Multitask_Exact_GPs/Hadamard_Multitask_GP_Regression.ipynb
https://docs.gpytorch.ai/en/stable/examples/04_Variational_and_Approximate_GPs/SVGP_Multitask_GP_Regression.html
I would appreciate any hints.
The text was updated successfully, but these errors were encountered: