Opsmo.CRPM (opsmo v0.3.4)

Logistic Regression model to Compute Resource Placement in a Cluster.

Input

It takes an input with the following

  • Requested CPU
  • Requested Memory
  • Requested Disk
  • Available CPU
  • Available Memory
  • Available Disk

[requested_cpu, requested_memory, requested_disk, available_cpu, available_memory, available_disk]

Each input value should be the normalized value between 0 and 1.

[0.05, 0.0625, 0.004, 0.825, 0.65, 0.55]
[0.05, 0.0625, 0.004, 0.314, 0.55, 0.45]
[0.05, 0.0625, 0.004, 0.954, 0.35, 0.55]

The above represents 3 nodes in the cluster. You can also add more nodes to the input if you have them. The requested resource is the same for the 3 nodes. What this does is it will ask the model to tell you the best node to place the requsted resource.

Usage

This model computes the placement of resources in a cluster. It takes a 6-dimensional input and outputs a 2-dimensional vector.

Summary

Functions

build_serving(trained_state \\ nil, batch_size \\ 3)

dump_state(state, name \\ "crpm")

See Opsmo.dump/2.

load_state(name \\ "crpm")

See Opsmo.load/1.

model()

Instantiate a new model.

predict(state, inputs)

Predicts the placement score for given input resources.

Parameters

  • model: The Axon model to use for prediction
  • state: The trained model state containing weights and biases
  • input: A list of 6 numbers representing [requested_cpu, requested_memory, requested_disk, available_cpu, available_memory, available_disk]

Returns

A 2-element list containing the prediction scores.

Example

iex> model = CRPM.model()
iex> state = CRPM.load()
iex> CRPM.predict(model, state, [0.05, 0.0625, 0.004, 0.825, 0.65, 0.55])
[0.8234, 0.1766]

process_inputs(inputs)

train(data, opts \\ [])

Train the model.

You can pass it a data stream or enumerable of data.

How to use

alias Opsmo.CRPM

data = CRPM.Dataset.train()

CRPM.train(data)