3048096493b85388ca00fc87c052e99767bddfc3,examples/plot_digits.py,,,#,24

Before Change


// Create images for a custom tooltip array
tooltip_s = []
for image_data in data:
    output = io.BytesIO()
    img = toimage(image_data.reshape((8, 8)))  // Data was a flat row of 64 "pixels".
    img.save(output, format="PNG")
    contents = output.getvalue()
    img_encoded = base64.b64encode(contents)
    img_tag = <img src="data:image/png;base64,{}">.format(img_encoded.decode("utf-8"))
    tooltip_s.append(img_tag)
    output.close()

tooltip_s = np.array(tooltip_s)  // need to make sure to feed it as a NumPy array, not a list

// Initialize to use t-SNE with 2 components (reduces data to 2 dimensions). Also note high overlap_percentage.

After Change



// Raw data is (0, 16), so scale to 8 bits (pillow can"t handle 4-bit greyscale PNG depth)
scaler = MinMaxScaler(feature_range=(0, 255))
data = scaler.fit_transform(data).astype(np.uint8)

// Create images for a custom tooltip array
tooltip_s = []
for image_data in data:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: MLWave/kepler-mapper
Commit Name: 3048096493b85388ca00fc87c052e99767bddfc3
Time: 2021-03-04
Author: dave@daveeargle.com
File Name: examples/plot_digits.py
Class Name:
Method Name:


Project Name: awslabs/mxboard
Commit Name: 409da8669036e4697fabe131976f0b4825258d48
Time: 2018-04-05
Author: wujun.nju@gmail.com
File Name: tests/python/unittest/test_logging.py
Class Name:
Method Name: test_add_image


Project Name: ilastik/ilastik
Commit Name: 09f11428ceeac33f36136e0dcb65659195e94c7c
Time: 2012-10-04
Author: bergs@janelia.hhmi.org
File Name: tests/testOpInputDataReader.py
Class Name: TestOpInputDataReader
Method Name: test_h5