pydnn.tools module

class pydnn.tools.Dot(skip=0)

Bases: object

dot(string=None)
stop()
pydnn.tools.H(num)
pydnn.tools.default(variable, dfault)
pydnn.tools.get_files(directory, rel=False, cache=False)
pydnn.tools.get_sub_dirs(directory, rel=False, cache=False)
pydnn.tools.h(num)
pydnn.tools.hum(num)
pydnn.tools.human(num)
pydnn.tools.image_tile(X, img_shape, tile_shape, tile_spacing=(0, 0), scale_rows_to_unit_interval=True, output_pixel_vals=True)

Transform an array with one flattened image per row, into an array in which images are reshaped and layed out like tiles on a floor.

This function is useful for visualizing datasets whose rows are images, and also columns of matrices for transforming those rows (such as the first layer of a neural net).

Parameters:
  • X (a 2-D ndarray or a tuple of 4 channels, elements of which can be 2-D ndarrays or None;) – a 2-D array in which every row is a flattened image.
  • img_shape (tuple; (height, width)) – the original shape of each image
  • tile_shape (tuple; (rows, cols)) – the number of images to tile (rows, cols)
  • output_pixel_vals – if output should be pixel values (i.e. int8 values) or floats
  • scale_rows_to_unit_interval – if the values need to be scaled before being plotted to [0,1] or not
Returns:

array suitable for viewing as an image. (See:Image.fromarray.)

Return type:

a 2-d array with same dtype as X.

pydnn.tools.load_config(environ_variable, module_file, default_config)
pydnn.tools.now()
pydnn.tools.num_abbrev(num, abbrev, sep)
pydnn.tools.raise_exception(x)
pydnn.tools.save_output(filename, func, *args, **kw)
pydnn.tools.scale_to_unit_interval(ndar, eps=1e-08)

Scales all values in the ndarray ndar to be between 0 and 1

pydnn.tools.send_email(from_addr, to_addr, username, password, smtp, subject='', body='')
pydnn.tools.tile_2d_images(images, canvas_shape)
pydnn.tools.time_once(method)