by: Kevin Broløs
Up until now, we haven't really delved much on the
registers themselves, as the default behaviour is sufficient for most use cases. That's about to change!
registers are responsible for providing the core context of your problem domain to your
QLattice, and are your gateway to feeding data in and getting predictions out.
License and registration, please
register is responsible for defining your inputs and outputs to the
QLattice and will lay the foundation for the
register at its core doesn't care if it's being used as an input or an output. It just registers a core concept and allows the
QLattice to connect the dots itself.
register is thus a special type of
interaction in our
graphs, and comes in two separate flavours, but more can be made available in the future.
So let's speak a bit about the amount of heavy lifting these
Why not both?
There are two types of
A cool way to register both kinds is to rely on the types in your DataFrame (obviously ensure that your DataFrame types match first by calling
for col in data.columns: if data[col].dtype == 'object': qlattice.get_register(name=col, register_type="cat") else: qlattice.get_register(name=col)
We do this all the time and we
The numerical register
register you might be familiar with already if you've read the previous guides is the
numerical one. This is a no-frills batteries-included
register that allows you to take numerical input of any kind, apply standardization to
Feyn's internal representation of
]-1;1[, and get a destandardized numerical output when used as an
It is also the only
register type that currently supports being used as an
cont_reg = qlattice.get_register(name="numerical_register")
The categorical register
This is a game changer for easily fitting in and learning from datasets that have categorical features with high cardinality. Normally, you'd either translate these to a sparse (label) encoding format or one-hot encode the values as separate features.
Here, you simply
register it as a
categorical register, like so:
cat_reg = qlattice.get_register(name="categorical_register", register_type="cat")
Feyn will automatically identify and label distinct values in sequence and assign them each individual weights in the resulting
graphs. Combining this with other cool features like our
Gaussian cells, means that we can handle large amounts of unique values, weight and sort them according to relevance and even single out specific values or clusters of values and give that information to you.
This also saves you the time of doing data preprocessing, as you can just fit in the data as-is.
registers perform auto-standardization by default.
Feyn has an internal representation ranging from
]-1;1[, which means that all data that passes in needs to be standardized to be within that range.
Thankfully, our good friends the
registers take care of that for us, so we can just worry about getting our dataset in tiptop shape and evaluating the outputs.
The default available standardizer is a MinMaxScaler akin to what you might be familiar with in
sklearn. For advanced use-cases, you can turn this off by setting the property
False on the state of your
register once you've fetched the
QGraph. You can then use your own standardization technique on the data prior to fitting the data into the graphs, and set the min/max values yourself. Keep in mind it has to adhere to the internal representation of
]-1;1[ (that is, minimum value -1, maximum value 1).
You can read more about this state on our API documentation page.