Belle II Software development
TSNE Class Reference
Inheritance diagram for TSNE:
Plotter

Public Member Functions

def add (self, data, columns, *masks)
 
def finish (self)
 

Detailed Description

Plots multivariate distribution using TSNE algorithm

Definition at line 1154 of file plotting.py.

Member Function Documentation

◆ add()

def add (   self,
  data,
  columns,
masks 
)
Add a new correlation plot.
@param data pandas.DataFrame containing all data
@param columns which are used to calculate the correlations
@param masks different classes to show in TSNE

Reimplemented from Plotter.

Definition at line 1159 of file plotting.py.

1159 def add(self, data, columns, *masks):
1160 """
1161 Add a new correlation plot.
1162 @param data pandas.DataFrame containing all data
1163 @param columns which are used to calculate the correlations
1164 @param masks different classes to show in TSNE
1165 """
1166 try:
1167 import sklearn
1168 import sklearn.manifold
1169 model = sklearn.manifold.TSNE(n_components=2, random_state=0)
1170 data = numpy.array([data[column] for column in columns]).T
1171 model.fit(data)
1172 for mask in masks:
1173 data = numpy.array([data[column][mask] for column in columns]).T
1174 data = model.transform(data)
1175 self.axis.scatter(data[:, 0], data[:, 1], rasterized=True)
1176 except ImportError:
1177 print("Cannot create TSNE plot. Install sklearn if you want it")
1178 return self
1179

◆ finish()

def finish (   self)
Sets limits, title, axis-labels and legend of the plot

Reimplemented from Plotter.

Definition at line 1180 of file plotting.py.

1180 def finish(self):
1181 """
1182 Sets limits, title, axis-labels and legend of the plot
1183 """
1184 return self
1185
1186

The documentation for this class was generated from the following file: