Belle II Software light-2406-ragdoll
TSNE Class Reference
Inheritance diagram for TSNE:
Collaboration diagram for TSNE:

Public Member Functions

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

Detailed Description

Plots multivariate distribution using TSNE algorithm

Definition at line 1151 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 1156 of file plotting.py.

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

◆ finish()

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

Reimplemented from Plotter.

Definition at line 1177 of file plotting.py.

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

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