Package org.apache.qpid.protonj2.codec
Interface StreamDecoder
-
- All Known Implementing Classes:
ProtonStreamDecoder
public interface StreamDecoder
Decode AMQP types from aInputStream
instance. When reading from an input stream care should be take to capture the stream position and state and reset if not enough bytes are available for the decoder to complete reading an encoded type as the decoder is not required to handle partially available type encodings.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StreamDecoderState
getCachedDecoderState()
Return a singletonStreamDecoderState
instance that is meant to be shared within single threaded decoder interactions.StreamDecoderState
newDecoderState()
Creates a newStreamDecoderState
instance that can be used when interacting with the Decoder.StreamTypeDecoder<?>
peekNextTypeDecoder(InputStream stream, StreamDecoderState state)
Peeks ahead in the givenInputStream
instance and returns aTypeDecoder
that can read the next encoded AMQP type from the stream's bytes.Binary
readBinary(InputStream stream, StreamDecoderState state)
Reads an encodedBinary
value from the givenInputStream
assuming that the next value in the byte stream is that type.ProtonBuffer
readBinaryAsBuffer(InputStream stream, StreamDecoderState state)
Reads an encodedBinary
value from the givenInputStream
assuming that the next value in the byte stream is that type.Boolean
readBoolean(InputStream stream, StreamDecoderState state)
Reads an encodedBoolean
value from the givenInputStream
assuming that the next value in the byte stream is that type.boolean
readBoolean(InputStream stream, StreamDecoderState state, boolean defaultValue)
Reads an encodedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type.Byte
readByte(InputStream stream, StreamDecoderState state)
Reads an encodedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type.byte
readByte(InputStream stream, StreamDecoderState state, byte defaultValue)
Reads an encodedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type.Character
readCharacter(InputStream stream, StreamDecoderState state)
Reads an encodedCharacter
value from the givenInputStream
assuming that the next value in the byte stream is that type.char
readCharacter(InputStream stream, StreamDecoderState state, char defaultValue)
Reads an encodedCharacter
value from the givenInputStream
assuming that the next value in the byte stream is that type.Decimal128
readDecimal128(InputStream stream, StreamDecoderState state)
Reads an encodedDecimal128
value from the givenInputStream
assuming that the next value in the byte stream is that type.Decimal32
readDecimal32(InputStream stream, StreamDecoderState state)
Reads an encodedDecimal32
value from the givenInputStream
assuming that the next value in the byte stream is that type.Decimal64
readDecimal64(InputStream stream, StreamDecoderState state)
Reads an encodedDecimal64
value from the givenInputStream
assuming that the next value in the byte stream is that type.DeliveryTag
readDeliveryTag(InputStream stream, StreamDecoderState state)
This method expects to read aBinary
encoded type from the provided stream and constructs aDeliveryTag
type that wraps the bytes encoded.Double
readDouble(InputStream stream, StreamDecoderState state)
Reads an encodedDouble
value from the givenInputStream
assuming that the next value in the byte stream is that type.double
readDouble(InputStream stream, StreamDecoderState state, double defaultValue)
Reads an encodedDouble
value from the givenInputStream
assuming that the next value in the byte stream is that type.Float
readFloat(InputStream stream, StreamDecoderState state)
Reads an encodedFloat
value from the givenInputStream
assuming that the next value in the byte stream is that type.float
readFloat(InputStream stream, StreamDecoderState state, float defaultValue)
Reads an encodedFloat
value from the givenInputStream
assuming that the next value in the byte stream is that type.Integer
readInteger(InputStream stream, StreamDecoderState state)
Reads an encodedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type.int
readInteger(InputStream stream, StreamDecoderState state, int defaultValue)
Reads an encodedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type.<V> List<V>
readList(InputStream stream, StreamDecoderState state)
Reads an encodedList
value from the givenInputStream
assuming that the next value in the byte stream is that type.Long
readLong(InputStream stream, StreamDecoderState state)
Reads an encodedLong
value from the givenInputStream
assuming that the next value in the byte stream is that type.long
readLong(InputStream stream, StreamDecoderState state, long defaultValue)
Reads an encodedLong
value from the givenInputStream
assuming that the next value in the byte stream is that type.<K,V>
Map<K,V>readMap(InputStream stream, StreamDecoderState state)
Reads an encodedMap
value from the givenInputStream
assuming that the next value in the byte stream is that type.<T> T[]
readMultiple(InputStream stream, StreamDecoderState state, Class<T> clazz)
Reads one or more encoded values from the givenInputStream
an return it as an array ofObject
instances which the caller must then interpret.StreamTypeDecoder<?>
readNextTypeDecoder(InputStream stream, StreamDecoderState state)
Reads from the givenInputStream
instance and returns aStreamTypeDecoder
that can read the next encoded AMQP type from the stream's bytes.Object
readObject(InputStream stream, StreamDecoderState state)
Reads an encoded value from the givenInputStream
an return it as anObject
which the caller must then interpret.<T> T
readObject(InputStream stream, StreamDecoderState state, Class<T> clazz)
Reads an encoded value from the givenInputStream
an return it as anObject
which the caller must then interpret.Short
readShort(InputStream stream, StreamDecoderState state)
Reads an encodedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type.short
readShort(InputStream stream, StreamDecoderState state, short defaultValue)
Reads an encodedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type.String
readString(InputStream stream, StreamDecoderState state)
Reads an encodedString
value from the givenInputStream
assuming that the next value in the byte stream is that type.Symbol
readSymbol(InputStream stream, StreamDecoderState state)
Reads an encodedSymbol
value from the givenInputStream
assuming that the next value in the byte stream is that type.String
readSymbol(InputStream stream, StreamDecoderState state, String defaultValue)
Reads an encodedString
value from the givenInputStream
assuming that the next value in the byte stream is that type.Long
readTimestamp(InputStream stream, StreamDecoderState state)
Reads an encoded AMQP time stamp value from the givenInputStream
assuming that the next value in the byte stream is that type.long
readTimestamp(InputStream stream, StreamDecoderState state, long defaultValue)
Reads an encoded AMQP time stamp value from the givenInputStream
assuming that the next value in the byte stream is that type.UnsignedByte
readUnsignedByte(InputStream stream, StreamDecoderState state)
Reads an encodedUnsignedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type.byte
readUnsignedByte(InputStream stream, StreamDecoderState state, byte defaultValue)
Reads an encodedUnsignedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type.UnsignedInteger
readUnsignedInteger(InputStream stream, StreamDecoderState state)
Reads an encodedUnsignedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type.int
readUnsignedInteger(InputStream stream, StreamDecoderState state, int defaultValue)
Reads an encodedUnsignedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type.long
readUnsignedInteger(InputStream stream, StreamDecoderState state, long defaultValue)
Reads an encodedUnsignedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type.UnsignedLong
readUnsignedLong(InputStream stream, StreamDecoderState state)
Reads an encodedUnsignedLong
value from the givenInputStream
assuming that the next value in the byte stream is that type.long
readUnsignedLong(InputStream stream, StreamDecoderState state, long defaultValue)
Reads an encodedUnsignedLong
value from the givenInputStream
assuming that the next value in the byte stream is that type.UnsignedShort
readUnsignedShort(InputStream stream, StreamDecoderState state)
Reads an encodedUnsignedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type.int
readUnsignedShort(InputStream stream, StreamDecoderState state, int defaultValue)
Reads an encodedUnsignedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type.short
readUnsignedShort(InputStream stream, StreamDecoderState state, short defaultValue)
Reads an encodedUnsignedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type.UUID
readUUID(InputStream stream, StreamDecoderState state)
Reads an encodedUUID
value from the givenInputStream
assuming that the next value in the byte stream is that type.<V> StreamDecoder
registerDescribedTypeDecoder(StreamDescribedTypeDecoder<V> decoder)
Allows customStreamDescribedTypeDecoder
instances to be registered with thisStreamDecoder
which will be used if the described type encoding is encountered during decode operations.
-
-
-
Method Detail
-
newDecoderState
StreamDecoderState newDecoderState()
Creates a newStreamDecoderState
instance that can be used when interacting with the Decoder. For decoding that occurs on more than one thread while sharing a singleStreamDecoder
instance a different state object per thread is required as theStreamDecoderState
object can retain some state information during the decode process that could be corrupted if more than one thread were to share a single instance. For single threaded decoding work theStreamDecoder
offers a utility cachedStreamDecoderState
API that will return the same instance on each call which can reduce allocation overhead and make using theStreamDecoder
simpler.- Returns:
- a newly constructed
EncoderState
instance.
-
getCachedDecoderState
StreamDecoderState getCachedDecoderState()
Return a singletonStreamDecoderState
instance that is meant to be shared within single threaded decoder interactions. If more than one thread makes use of this cachedStreamDecoderState
the results of any decoding done using this state object is not guaranteed to be correct. The returned instance will have its reset method called to ensure that any previously stored state data is cleared before the next use.- Returns:
- a cached
StreamDecoderState
linked to this Decoder instance that has been reset.
-
readBoolean
Boolean readBoolean(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedBoolean
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readBoolean
boolean readBoolean(InputStream stream, StreamDecoderState state, boolean defaultValue) throws DecodeException
Reads an encodedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readByte
Byte readByte(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readByte
byte readByte(InputStream stream, StreamDecoderState state, byte defaultValue) throws DecodeException
Reads an encodedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedByte
UnsignedByte readUnsignedByte(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedUnsignedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedByte
byte readUnsignedByte(InputStream stream, StreamDecoderState state, byte defaultValue) throws DecodeException
Reads an encodedUnsignedByte
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readCharacter
Character readCharacter(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedCharacter
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readCharacter
char readCharacter(InputStream stream, StreamDecoderState state, char defaultValue) throws DecodeException
Reads an encodedCharacter
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readDecimal32
Decimal32 readDecimal32(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedDecimal32
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readDecimal64
Decimal64 readDecimal64(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedDecimal64
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readDecimal128
Decimal128 readDecimal128(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedDecimal128
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readShort
Short readShort(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readShort
short readShort(InputStream stream, StreamDecoderState state, short defaultValue) throws DecodeException
Reads an encodedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedShort
UnsignedShort readUnsignedShort(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedUnsignedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedShort
short readUnsignedShort(InputStream stream, StreamDecoderState state, short defaultValue) throws DecodeException
Reads an encodedUnsignedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedShort
int readUnsignedShort(InputStream stream, StreamDecoderState state, int defaultValue) throws DecodeException
Reads an encodedUnsignedShort
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readInteger
Integer readInteger(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readInteger
int readInteger(InputStream stream, StreamDecoderState state, int defaultValue) throws DecodeException
Reads an encodedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedInteger
UnsignedInteger readUnsignedInteger(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedUnsignedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedInteger
int readUnsignedInteger(InputStream stream, StreamDecoderState state, int defaultValue) throws DecodeException
Reads an encodedUnsignedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedInteger
long readUnsignedInteger(InputStream stream, StreamDecoderState state, long defaultValue) throws DecodeException
Reads an encodedUnsignedInteger
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readLong
Long readLong(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedLong
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readLong
long readLong(InputStream stream, StreamDecoderState state, long defaultValue) throws DecodeException
Reads an encodedLong
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedLong
UnsignedLong readUnsignedLong(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedUnsignedLong
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUnsignedLong
long readUnsignedLong(InputStream stream, StreamDecoderState state, long defaultValue) throws DecodeException
Reads an encodedUnsignedLong
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readFloat
Float readFloat(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedFloat
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readFloat
float readFloat(InputStream stream, StreamDecoderState state, float defaultValue) throws DecodeException
Reads an encodedFloat
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readDouble
Double readDouble(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedDouble
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readDouble
double readDouble(InputStream stream, StreamDecoderState state, double defaultValue) throws DecodeException
Reads an encodedDouble
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readBinary
Binary readBinary(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedBinary
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readBinaryAsBuffer
ProtonBuffer readBinaryAsBuffer(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedBinary
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source and returned in a
ProtonBuffer
. - Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readDeliveryTag
DeliveryTag readDeliveryTag(InputStream stream, StreamDecoderState state) throws DecodeException
This method expects to read aBinary
encoded type from the provided stream and constructs aDeliveryTag
type that wraps the bytes encoded. If the encoding is a NULL AMQP type then this method returnsnull
.- Parameters:
stream
- TheInputStream
to read a Binary encoded value fromstate
- The current encoding state.- Returns:
- a new DeliveryTag instance or null if an AMQP NULL encoding is found.
- Throws:
DecodeException
- if an error occurs while decoding theDeliveryTag
instance.
-
readString
String readString(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedString
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readSymbol
Symbol readSymbol(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedSymbol
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readSymbol
String readSymbol(InputStream stream, StreamDecoderState state, String defaultValue) throws DecodeException
Reads an encodedString
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readTimestamp
Long readTimestamp(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encoded AMQP time stamp value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source and return a
Long
with the time value. - Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readTimestamp
long readTimestamp(InputStream stream, StreamDecoderState state, long defaultValue) throws DecodeException
Reads an encoded AMQP time stamp value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.defaultValue
- A default value to return if the next encoded value is a Null encoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readUUID
UUID readUUID(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedUUID
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readObject
Object readObject(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encoded value from the givenInputStream
an return it as anObject
which the caller must then interpret.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not able to be decoded.
-
readObject
<T> T readObject(InputStream stream, StreamDecoderState state, Class<T> clazz) throws DecodeException
Reads an encoded value from the givenInputStream
an return it as anObject
which the caller must then interpret.- Type Parameters:
T
- the type that will be used when casting and returning the decoded value.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.clazz
- TheClass
type that should be used to cast the returned value.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not able to be decoded.
-
readMultiple
<T> T[] readMultiple(InputStream stream, StreamDecoderState state, Class<T> clazz) throws DecodeException
Reads one or more encoded values from the givenInputStream
an return it as an array ofObject
instances which the caller must then interpret.- Type Parameters:
T
- the type that will be used when casting and returning the decoded value.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.clazz
- TheClass
type that should be used to cast the returned array.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not able to be decoded.
-
readMap
<K,V> Map<K,V> readMap(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedMap
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Type Parameters:
K
- The key type for the map that is being read.V
- The value type for the map that is being read.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readList
<V> List<V> readList(InputStream stream, StreamDecoderState state) throws DecodeException
Reads an encodedList
value from the givenInputStream
assuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should mark the and reset the input to make a further read attempt.- Type Parameters:
V
- The value type for the list that is being read.- Parameters:
stream
- TheInputStream
where the read operation takes place.state
- TheDecoderState
that the decoder can use when decoding.- Returns:
- the value read from the provided byte source.
- Throws:
DecodeException
- if the value fails to decode is not of the expected type,
-
readNextTypeDecoder
StreamTypeDecoder<?> readNextTypeDecoder(InputStream stream, StreamDecoderState state) throws DecodeException
Reads from the givenInputStream
instance and returns aStreamTypeDecoder
that can read the next encoded AMQP type from the stream's bytes. If an error occurs attempting to read and determine the next type decoder anDecodeException
is thrown.- Parameters:
stream
- The stream to read from to determine the nextTypeDecoder
needed.state
- TheDecoderState
value that can be used for intermediate decoding tasks.- Returns:
- a
StreamTypeDecoder
instance that can read the next type in the stream. - Throws:
DecodeException
- if an error occurs while reading the next type decoder.
-
peekNextTypeDecoder
StreamTypeDecoder<?> peekNextTypeDecoder(InputStream stream, StreamDecoderState state) throws DecodeException
Peeks ahead in the givenInputStream
instance and returns aTypeDecoder
that can read the next encoded AMQP type from the stream's bytes. If an error occurs attempting to read and determine the next type decoder anDecodeException
is thrown. The underlying stream is not modified as a result of the peek operation and the returnedTypeDecoder
will fail to properly read the type until the encoding bytes are read. If the provided stream does not offer support for the mark API than this method can throw anUnsupportedOperationException
.- Parameters:
stream
- The stream to read from to determine the nextTypeDecoder
needed.state
- TheDecoderState
value that can be used for intermediate decoding tasks.- Returns:
- a
TypeDecoder
instance that can provide insight into the next type in the stream. - Throws:
DecodeException
- if an error occurs while peeking ahead for the next type decoder.
-
registerDescribedTypeDecoder
<V> StreamDecoder registerDescribedTypeDecoder(StreamDescribedTypeDecoder<V> decoder)
Allows customStreamDescribedTypeDecoder
instances to be registered with thisStreamDecoder
which will be used if the described type encoding is encountered during decode operations.- Type Parameters:
V
- The type that the decoder reads.- Parameters:
decoder
- AStreamDescribedTypeDecoder
instance to be registered with thisStreamDecoder
- Returns:
- this
StreamDecoder
instance.
-
-


IMPORTANT: Development is paused right now. Use at your own risk.
Discussion and questions about HyperDEX atomic swap powered decentralized exchange. The project is maintained by HyperDEX team.
100 messages
Before 05-Dec-19 12:00 AM
D2D privacyalternatives.com26-Jul-19 01:28 PM
Ah OK thanks!
Is it in alpha, beta...?
gcharang26-Jul-19 01:29 PM
consider all the different GUIs to be in beta
some might be in alpha
Atomic swaps have the potential to improve the cryptocurrency space and are yet to be tested on a broader scale. Learn about Atomic Swaps on Binance Academy
1
D2D privacyalternatives.com26-Jul-19 01:31 PM
I've already added Barterlly and AtomixDEX on my directory
I added (beta) so that people now, but they are the most voted exchanges so far
Maybe I can already add Chainswap and hyperDEX too
or maybe it's too early for hyperDEX?
I think Chainswap is now fully released
gcharang26-Jul-19 01:33 PM
Barterlly is a escrow OTC trading service, not a DEX
they have plans to integrate it in the future I think
@D2D privacyalternatives.com
1
D2D privacyalternatives.com26-Jul-19 01:34 PM
Yes I put them all under exchanges but it explains that it's OTC
Will have to change the title a bit because Digital Price is not decentralised, but they are good
NMD326-Jul-19 03:42 PM
Anyone on Debian 9 ?
AppImage & deb are not working on my system. Can see it for a short time in taskmanager, but no window opens.
27aume26-Jul-19 06:34 PM
Did a couple of rick_morty swaps, worked very well for now
hyperDEX26-Jul-19 10:21 PM
@D2D privacyalternatives.com maybe another distinction, hyperDEX is the only one with a market view where limit orders are places. atomicDEX and Chainmaker's DEX does market orders like shapeshift.
Sharifa27-Jul-19 11:27 AM
@hyperDEX is it possible technically to list $ARRR on #DEX?
hyperDEX27-Jul-19 11:48 AM
@Sharifa not yet. We dont support native at the moment
mobipoi27-Jul-19 01:22 PM
Will it be possible to add features in which all order pairs of a specific coin can be seen(edited)
Because of the liquidity multiplier , this can help sellers to navigate which actual coin they want(edited)
So e.g Kmd/k64 , kmd/btc ,Kmd/bch, kmd/dex etc .....
hyperDEX27-Jul-19 09:31 PM
@mobipoi that is something we will be working on as soon as the core functionality is stable.
That is our focus right now, that we refactor the code to mm2.0 that we make sure all the little bugs and so forth are done so normal users can place simple orders and get them executed. Once that is done we will add on further functionality
willofleo27-Jul-19 09:43 PM
ok that is a cool feature but I think it better we focus on the main things first @mobipoi as hyper said(edited)
hyperDEX27-Jul-19 09:51 PM
It is part of the road map, liquidity multiplier option and market maker bot
My 10 year old boy just did #atomicswaps, selling $KMD for $DOGE on my #Android phone in about 3 minutes with #Tor while my #dVPN was still on as well.
Apparently he was tired of swapping $RICK for $MORTY
#Komodo's #decentralized exchange $KMD is truly amazing ...
1
1
hastrup30-Jul-19 03:30 PM
Unhandled Promise Rejection
TypeError: Failed to fetch i got this error
its swapping but the gui is not complete but if i restart it has swap finish
Sharifa30-Jul-19 04:46 PM
@hyperDEX when Accointing tax optimizer ?
You could offer this automized software solution to Premium members who pay it with $KMD/$DEX .
It could be an extra revenue stream, no?
phm8730-Jul-19 05:03 PM
Taxes on internationnal lvl are complicated. There are some data on CMC but we may need 150 fiscal experts and with huge risks I guess @Sharifa
But your idea is good on paper, I like it. I had a similar project called tax load balancing but I never found investors to fund it
Sharifa30-Jul-19 06:15 PM
@phm87 oh so it needs to be a Project built on Komodo then?
phm8730-Jul-19 06:17 PM
No. I was not talking about kmd sorry
But yeah doing it on komodo can be easier because tech is already there. Pb of taxes is complex formulaes and always changing
I heard of 1 of the big 4 that have an optimization tax app on international lvl, it did cost more than 100 millions but .... it made them earn way more.
hyperDEX30-Jul-19 08:18 PM
@hastrup thanks. We will get a new build out soon that should hopefully addresses these issues.
@Sharifa not touching tax, too many crazy laws. Will keep it simple, an export option for trades
2
hastrup31-Jul-19 03:03 PM
@hyperDEX
bogybogy31-Jul-19 09:06 PM
Gents
I need some help
hyperDEX31-Jul-19 10:30 PM
@bogybogy with what?
miles02-Aug-19 01:54 PM
hi @hyperDEX - just got latest version and tried a KMD > DEX swap - seems stuck ID: f8ce9b0e-9318-46a5-a524-f9a15d21ca12 - anything you can see you end?
allbits02-Aug-19 02:33 PM
@miles this looks like a mm2 issue and not a GUI issue. Check #dev-marketmaker
miles02-Aug-19 02:44 PM
thanks @allbits - will do
artem.pikulin12-Aug-19 01:06 PM
@miles Hi! I've checked your swap status on the seednode and can see that other side swap was completed with refund. Due to the bug of MM2 (https://github.com/KomodoPlatform/atomicDEX-API/issues/502) your payment is stuck until MM2 is updated in HyperDEX bundle. But once you update the app with new MM2 it will be refunded. Please ensure that you don't delete the app data since it will be harder to recover if MM2 database is removed.
This is the official AtomicAPI (atomicDEX API) repository - KomodoPlatform/atomicDEX-API
miles12-Aug-19 05:21 PM
@artem.pikulin thanks so much for the follow up!! I actually checked git on the weekend and saw you had been busy!! Still have the swap in hyperdex so will wait for team to update mm2. Loving mm2 btw with AtomicDEX, hyperdex and chainswap - great work
@Mylo no roadmap as such, going as fast as funding and devs will allow.
1
I have 2 devs working on the mm2.0 and 1 dev working with the team on the market maker bot so we can get that into hyperDEX ASAP
3
hastrup13-Aug-19 07:37 AM
@hyperDEX you are a legend!
hyperDEX13-Aug-19 07:46 AM
@hastrup jl777 and the team are legends, i am just doing my part to make sure that others in the industry realize that
hastrup13-Aug-19 07:54 AM
@hyperDEX there is room enough for you and your team to also be legends XD haha if the mm2 is a success then im looking forward to help whit finance as well :)
hyperDEX13-Aug-19 07:58 AM
haha we will see. Artem and the mm2.0 has done a good job. Just need to get it feature complete. But i think we are all in a good place and KMD is on track to deliver big time.
Oszy13-Aug-19 03:39 PM
@lukechilds@hyperDEX latest releaase has a bug (github issues #618)
phideas17-Aug-19 09:56 AM
bug solved in latest nightly, exchange works again. thanks @lukechilds
still not possible to withdraw or swap 'max amount' with automatic fee calc. i'd really like this feature to be implemented.
another idea (killer feature) could be to convert any dust or low value coin into kmd with one click, similar to binance - bnb.(edited)
hyperDEX17-Aug-19 11:31 AM
@phideas we will look into those.
1
CoinKing8821-Aug-19 04:38 PM
Are there any stats on the amount of transactions being done right now on the atomic dex?
hyperDEX21-Aug-19 08:26 PM
@CoinKing88 dont think mm2.0 has that api yet. @CHMEX is waiting on that to add it to his site
peddycb29-Aug-19 10:18 AM
hello together I'm testing Hyperdex ...
I get an error message when logging in ...
(Login Failed ... json.Data.map is not a function)
what am I doing wrong ?
phm8729-Aug-19 10:40 AM
Maybe @hyperDEX knows
hyperDEX30-Aug-19 05:54 AM
@peddycb which version are you running? The official builds are depreciated, nightly is up to date.
peddycb30-Aug-19 02:47 PM
oki doki I'll try the new version
miles02-Sep-19 02:55 PM
hi @hyperDEX - i took the latest nightly build to see if the stuck swap discussed above with @artem.pikulin would now return the funds, but it hasn't worked. Should it now now resolve in that issue? Do i need to wait for the 4 hrs with the app running?
hyperDEX02-Sep-19 08:07 PM
@miles from my understanding once the new mm2.0 was pulled into the build it should just work. @artem.pikulin any ideas what else miles needs to do?
jspook1603-Sep-19 12:54 AM
Is this channel for the hyperdex desktop app?
hastrup03-Sep-19 03:37 AM
@jspook16 yes :)
artem.pikulin03-Sep-19 04:22 AM
@miles Hi, did you enable KMD and DEX coins after opening the HyperDEX app? MM2 requires the coins to be activated for swap to automatically kickstart.
If coins are activated but your payment is not refunded I will need MM2 logs to check what's going on. @hyperDEX Can MM2 logs be viewed from HyperDEX app?
miles03-Sep-19 06:51 AM
Thanks guys for response, both coins were activated and the swap was still active at step 5/7 but didn’t refund. I am away for a couple of days but if you let me know how I can grab the logs or some info to debug I can look at it Friday if that helps
coin parameters and all files needed for GUI support - jl777/coins
Artist05-Sep-19 10:49 PM
is KMD official creater of hyperdex
grewalsatinder06-Sep-19 01:45 AM
no, @hyperDEX is
miles06-Sep-19 07:27 AM
<EMAIL_ADDRESS>- just ran the latest nightly and the swap got refunded instantly - only thing i have noticed is there is no record of the swap having every occurred in the swap history which seems odd as other have reported as failed
1
miles06-Sep-19 07:42 AM
but the funds are back which is the main thing that proves the MM2 fixes is now working in HyperDex - thank you both
hyperDEX06-Sep-19 08:48 AM
@phideas will get that checked. @miles will need to look into that too
3
hyperDEX08-Sep-19 09:09 PM
@phideas the fix is in, waiting for a new build
1
phideas08-Sep-19 09:14 PM
Thanks! I will continue testing.
phideas12-Sep-19 11:13 AM
i can confirm zcash works ok with latest nightly. swap deposit withdraw no issue.
what i am missing currently is a button to cancel open orders. only possible if i shutdown the app itself which is not perfect.
hyperDEX12-Sep-19 11:35 AM
Cancel is a bit tricky
But we will sort that out sooner rather than later
1
FTL_Ian17-Sep-19 03:45 AM
Hello, I am a new user, having just downloaded 0.4.0 for Linux. I wanted to see if my seed words for AtomicDEX would work in HyperDEX and they mostly didn't. HyperDEX sees my Bitcoin Cash balance, but not BTC, KMD, or ETH.
FTL_Ian17-Sep-19 04:52 AM
When I connect to a HyperDEX account, there is an error that says "Couldn't Connect to ETOMIC Electrum Server", but evenutally the wallet does load.
FTL_Ian17-Sep-19 05:41 AM
I have sent both BTC and USDT to my HyperDEX wallet. The USDT showed up no problem, however the BTC is not showing despite having several confirmations.


Munzner (2016)
A human “superpower”:
what-why-how
↓
data-task-idiom
Most ineffective designs are due to a poor match
Domain-specific → Abstract form
Vis is
A tool that serves well for one task can be poorly suited for another
Maps can fulfill several needs, looking very different depending on the end-goal
MacEachren & Kraak (1997) identify three main dimensions:
Align with your purpose
TIP: check ColorBrewer for guidance
Web Mapping & Analysis by Dani Arribas-Bel is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.


My name is Peter O. Elimimian. I am aspiring to be a full stack web developer. I majored in Computer Science at the University of Mary Washington. I currently only have a handful projects, but I intend add more web applications to this website portfolio.


 We do have a couple of burger restaurants that are capable of doing a good
SUGGESTED RESTAURANTS
Define Search criteria to search for specific
5th Avenue New York 68
Domino's Pizza
5th Avenue New York 68
Pizza Hut
5th Avenue New York 68
Burger King
MY BOOKINGS
| RESTAURANT NAME | DATE | STATUS |
|---|---|---|
Jet's Kitchen ( #8589 ) |
Aug 17,2017 | PROCESSING |
Jet's Kitchen ( #8589 ) |
Aug 17,2017 | PROCESSING |
Jet's Kitchen ( #8589 ) |
Aug 17,2017 | COMPLETED |
Jet's Kitchen ( #8589 ) |
Aug 17,2017 | PROCESSING |
Jet's Kitchen ( #8589 ) |
Aug 17,2017 | COMPLETED |
MY REVIEWS
RESTAURANT DEMO
FoodBakery order today. So great to be able to order food and not have to talk to anyone.
QLARK JAKSON
2 months AgoRESTAURANT DEMO
FoodBakery order today. So great to be able to order food and not have to talk to anyone.
QLARK JAKSON
2 months AgoRESTAURANT DEMO
FoodBakery order today. So great to be able to order food and not have to talk to anyone.
QLARK JAKSON
2 months AgoMY ORDERS
5th Avenue New York 68
Maenaam Thai Restaurant
Lorem Ipsum is simply dummy text of the printing industry
$85.00 PROCESSING Order Detail
5th Avenue New York 68
Maenaam Thai Restaurant
Lorem Ipsum is simply dummy text of the printing industry
$85.00 COMPLETED Order Detail
5th Avenue New York 68
Maenaam Thai Restaurant
Lorem Ipsum is simply dummy text of the printing industry
$85.00 COMPLETED Order Detail
5th Avenue New York 68
Maenaam Thai Restaurant
Lorem Ipsum is simply dummy text of the printing industry
$85.00 COMPLETED Order DetailSHORTLISTS
5th Avenue New York 68
Domino's Pizza
5th Avenue New York 68
Pizza Hut
5th Avenue New York 68
Burger King
STATEMENTS
| TRANSACTION ID | ORDER ID | DATE | DETAIL | AMOUNT |
|---|---|---|---|---|
| #30737723 | 8720 | Aug 17,2017 | Order - Misumisu Thai | $35.97 |
| #30737723 | 8720 | Aug 17,2017 | Order - Jet's Kitchen | $35.97 |
| #30737723 | 8720 | Aug 17,2017 | Order - Misumisu Thai | $35.97 |
| #30737723 | 8720 | Aug 17,2017 | Order - Misumisu Thai | $35.97 |
| #30737723 | 8720 | Aug 17,2017 | Order - Misumisu Thai | $35.97 |


Opening the black box of Deep Learning
Deep Learning is one of the three main paradigms of Machine Learning, and roughly consists on extracting patterns from data using neural networks.
Its impact in modern technologies is huge. However, there is not a clear high-level description of what these algorithms are actually doing.
In this sense, Deep Learning models are sometimes referred to as “black box” models”; that is, we can characterize the models by its inputs and outputs, but with any knowledge of its internal workings.
The aim is then to open the black box of Deep Learning, and try to gain an intuition of what are these models doing.
One of the most succesful mathematical theories in recent years has been connecting Deep Learning with Dynamical Systems.
The aim of this post is to introduce to some of those exciting ideas.
Data and classification
Supervised Learning
Deep Learning essentially wants to solve the problem of Supervised Learning. That is, we want to learn a function that maps an input to an output, based on examples of input-output pairs.
A classical Deep Learning problem would be the following: we have some pictures of cats and dogs, and want to make an algorithm that learns when the input image shows a dog and when it shows a cat. Note that we could give the algorithm pictures that it has not previously seen, and the algorithm should label the pictures correctly.
A formal description of our problem is the following.
Consider a dataset $\mathcal{D}$ consisting on $S$ distinct points ${x_i}_{i=1}^{S}$, each of them with a corresponding value $y_i$ such that
we expect that the labels $y_i$ are a function of $x$, such that
where $\epsilon _i$ is included so as to consider, in principle, noisy data.
The aim of supervised learning is to recover the function $\mathcal{F}(\cdot)$ such that not only fits well in the database $\mathcal{D}$ but also generalises to previously unseen data.
That is, it is inferred the existence of
where
being $\mathcal{F} (\cdot)$ the desired previous application, and $\mathcal{D} \subset \tilde{\mathcal{D}}$.
Figure 1. *The figure in the left represents a finite set of points in $(x,y)$, where $x$ represents the input and $y$ the output. The figure on the right is the expected distribution from which we are sampling the input-output examples. The whole distribution can be understood by $\tilde{\mathcal{D}}$.*
A well-known dataset in which to use Deep Learning algorithm is the CIFAR-10 dataset.
Figure 2. Scheme of the CIFAR-10 dataset.
In this case, the input images consist on a value in $[0,1]$ for each pixel and Red / Green / Blue color. Since the resolution is $32 \times 32$ pixels, the input space would be $[0,1]^d$ with $d=32 \times 32 \times 3 = 3072$. Each image has a correspondent label (airplane, automobile, …).
The dataset is then given by $ { x_j, y_j = f^{\star(x_j)} } $ where the inputs $ x_j \in [0,1]^{3072} $, and the labelling function acts as $f^* : [0,1]^{3072} \to { \text{airplane, automobile, … } }$.
We want that $ f^*( \text{each image} ) = \text{correct label of that image} $.
Note that the function $ f^* $ we are talking about is not the same as the function $\mathcal{F}$ that we used when defining the notion of dataset. This is because the function $ f^* $ is the application that connects the images with their given labels, whereas the function $\mathcal{F}$ is the function that connects any feasible input image with its true label. We have access to $f^*$, but not $\mathcal{F}$.
Noisy vs. noisless data
What are the true labels of a dataset? We have no a priori idea. What is the mathematical definition of “pictures of airplanes”? Our best guess is to learn the definition by seing examples.
However, those examples may be mistakenly labelled, since the datasets are in general noisy. What does a noisy dataset mean?
-
We refer to noisy data when the samples in our dataset $\tilde{\mathcal{D}}$ actually comes from a random vector $(\mathbf{x}, \mathbf{y})$ with a non-deterministic joint distribution, such that it is not possible to find a function $\mathcal{F}$ such that $\mathcal{F}(\mathbf{x}) = \mathbf{y}$.
The aim of supervised learning, in this case, would be to find a function such that
$\mathcal{F}(\mathbf{x}) \approx \mathbf{y}$. For example, $\mathcal{F}(\tilde{x}_i) = \tilde{y}_i$ for almost every sample $i$.
-
In the case of noisless data (which does not happen in most practical situations, but it makes things far simpler) then it is possible to find a function $\mathcal{F}$ such that $\mathcal{F}(\tilde{x}_i) = \tilde{y}_i \; \forall i$, or equivalently $\mathcal{F}(\mathbf{x}) = \mathbf{y}$.
Note that, given that the probability of a collision (of having two different data-points such that $x_i = x_j$ for $i \neq j$) is practically $0$, it is in principle possible to find a function $\mathcal{F}$ such that $\mathcal{F}(x_i)=y_i$ for all of our samples i, even in the noisy case (for example, we may use interpolation).
However, the aim of supervised learning is to be able to generalise well to previously unseen data, $\tilde{\mathcal{D}}$, and so interpolation is not effective, and may not be well-defined, since the same input $x_i$ can be labelled differently, due to noise.
Representation of the optimal function $\mathcal{F}$ as the number of samples increases, in the case of noisy data. Note that the function “stabilizes” at a certain point, and thus it is expected to behave properly in the limit of infinitely many samples.
Representation of the optimal function $\mathcal{F}$ as the number of samples increases, in the case of noisless data. In this case the function could have been obtained by interpolation, and would stabilize fast.
Binary classification
In most cases, the data points $x_i$ are in $\mathbb{R}^{n}$. In general, we may restrict to a subspace of feasible images $X \in \mathbb{R}^{n}$.
So as to ease the training of the models, the inputs are usually normalized, and it is considered $X = [-1,+1]^{n}$, with $n$ the input dimension.
There are different supervised learning problems depending on the space $Y$ of the labels.
If $Y$ is discrete, such that $Y = { 0, … , L-1}$, then we are dealing with the problem of classification. In the case of CIFAR-10 we have $10$ classes, and so $L=10$.
If $L=2$, then it is a binary classification problem, such as in the case of classifying images of cats and dogs (in this case, dog may be represented by “0” and cat by “1”).
In the particular setting of binary classification, the aim is to find a function $\mathcal{F} (x)$ such that it returns $0$ whenever the corresponding data point $x$ is of class $0$, and $1$ conversely.
Data, subspaces and manifolds
Consider $M^0$ the subset of $X$ such that $F( \tilde{x} _i) =0$ for all the points $\tilde{x}_i$ in $M^0$. And consider $M^1$ such that $\, F(\tilde{x}_i)=1$ for all the points in $M^1$.
It is useful to consider $d(M^0 , M^1) > \delta$. That is, we want the subspace of images of cats and the subspace of images of dogs to have a nonzero distance in the input space. This makes sense physically, since we do not expect the pictures of dogs and cats to overlap.
An interesting hypothesis is to consider that $M^0$ and $M^1$ are indeed manifolds in a low-dimensional space. This is called the manifold hypothesis.
That is, out of the whole input space of all possible images, only a low-dimensional subspace of those would correspond to the images of cats, and one could go from one picture of a cat to any other picture of a cat by a path in which all the point are also pictures of cats. This has been widely hypothesized in many datasets, and there are some experimental results in that direction [9].
Example of the input space in a binary classification setting. The axis $\mathbf{x}^1$ and $\mathbf{x}^2$ represent the components of the vectors $x$ the input space (we are considering $[0,1]^2$). The points in the subspace $M_0$ are labelled as $0$, and the points in $M_1$ as $1$. The points that are not in $M_0$ or $M_1$ do not have a well-defined label
Deep Learning
Now that we have some inuition about the data, it’s time to focus on how to approximate the functions $f$ that would fit that data.
When doing supervised learning, we need three basic ingredients:
- An hypothesis space, $\mathcal{H}$, consisting on a set of trial functions. All the functions in the hypothesis space can be determined by some parameters $\theta$. That is, all the functions $f \in \mathcal{H}$ are given by $f ( \cdot ; \theta )$. We therefore want to find the best parameters $\theta ^*$.
- A loss function, that tells us how close we are from our desired function.
- An optimization algorithm, that allows us to update our parameters at each step.
Our algorithm consists on initializing the process by choosing a function $f( \cdot , \theta) \in \mathcal{H}$. In Deep Learning, this is done by randomly choosing some parameters $\theta _0$, and initializing the function as $f( \cdot ; \theta_0)$.
In Deep Learning, the loss function is given by the empirical risk. That is, we choose a subset of the dataset,
and compute the loss as
, where
could be simply given by
.
The optimization algorithms used in Deep Learning are mainly based in Gradient Descent, such as
Where the subindex denotes the parameters at each iteration.
We expect our algorithm to converge; that is, we want that, as $k \to \infty$, we would have $\theta_{k}$ close to $\theta^*$, where the notion of “closeness” is given by the chosen loss function.
Paradigms of Deep Learning
There are many questions about Deep Learning that are not yet solved. Three of that paradigms, that woud be convenient to treat mathematically, are:
- Optimization: How to go from the initial function, $F_0$, to a better function $\tilde{F}$? This has to do with our optimization algorithm, but also depends on how do we choose the initialization, $F_0$.
- Approximation: Is the ideal solution $ F^* $ in our hypothesis space $\mathcal{H}$? Is $\mathcal{H}$ at least dense in the space of feasible ideal solutions $ F^* $ ? This is done by characterizing the function spaces $\mathcal{H}$.
- Generalization: How does our function $\tilde{F}$ generalise to previously unseen data? This is done by studying the stochastic properties of the whole distribution, given by the generalised dataset.
Diagram of the three main paradigms of Deep Learning. The function $F_0$ is the initial one, $\tilde{F}$ is the final solution as updated by the optimization algorithm, $\hat{F}$ is the closest function in $\mathcal{H}$ to $F^*$, and $F^*$ is the best ideal solution.
The problem of approximation is somehow resolved by the so-called Universal Approximation Theorems (look, for example, at the results by Cybenko [11]). This results state that the functions generated by Neural Networks are dense in the space of continuous functions. However, in principle it is not clear what do we gain by increasing the number of layers (using deeper Neural Networks), that seem to give better results in practuce.
Regarding optimization, altough algorithms based in Gradient Descent are widely used, it is not clear whether the solution gets stucked in local minima, if convergence is guaranteed, how to initialize the functions…
When dealing with generalization, everything gets more complicated, because we have to derive some properties of the generalised dataset, from which we do not have access. It is probably the less understood of those three paradigms.
Indeed, those three paradigms are very connected. For example, if the problem of optimization is completely solved, we would know that our final solution given by the algorithm, $\tilde{F}$, would be the best possible solution in the hypothesis space, $\hat{F}$; and if approximation is solved, we would also end up getting the ideal solution $F^*$.
One of the main problems regarding those questions is that the hypothesis space $\mathcal{H}$ is generated by a Neural Network, and so it is quite difficult to characterize mathematically. That is, we do not know much about the shape of $\mathcal{H}$ (although the Universal Approximation Theorems give valuable insight here), nor how to “move” in the space $\mathcal{H}$ by tuning $\theta$.
Let’s take a look at how the hypothesis spaces look like.
Hypothesis spaces
In classical settings, an hypothesis space is often proposed as
where $\theta = { a_i }_{i=1}^{m}$ are the coefficients, ${ \psi _i}$ are the proposed functions (for example, they would be monomials if we are doing polynomial regression).
The function $\mathcal{F}$ correspondent to the dataset $\mathcal{D}$ is then defined as
where $d$ is a distance defined by a loss function, and $\phi$ is a function that transforms $f(x_i; \theta)$ such that we can compare it with $y_i$. For example, if we want to do binary classification, we would use $\phi$ as a function that divides the space into two hiperplanes, and assigns $0$ to one of the parts of the divided space, and $1$ to the other.
This means that it is the function in the hypothesis space that minimizes the distance with the target function, which connects the datapoints $x_i$ with their correspondent labels $y_i$.
When using Deep Neural Networks, the hypothesis space $\mathcal{H}$ is generated by the composition of simple functions $f$ such that
where $\theta = { \theta_k }_{k=1}^{L}$ are the training weights of the network and $L$ the number of hidden layers.
Multilayer perceptrons
In the case of the so-called multilayer perceptrons, the functions $f^k_{\theta_k}$ are constructed as
being $A^k$ a matrix, $b^k$ a vector, $\theta _k =
{A^k , b^k}$ and $\sigma \in C^{0,1}(\mathbb{R})$ a fixed nondecreasing function, called the activation function.
Since we restrict to the case in which the number of neurons is constant through the layers, we have that $A^k \in \mathbb{R}^{d \times d}$ and $b^k \in \mathbb{R}^d$.
Diagram of a multilayer perceptron, also called fully-connected neural network. However, this graph representation seems a bit difficult to treat, so we use an algebraic representation instead
That is, shematically, one has that $\mathcal{H} = { F : F(x) = F_T \circ F_{T-1} \circ … \circ F_0 (x) }$, the hypothesis space is generated by the discrete composition of functions.
It can be seen that the complexity of the hypothesis spaces in Deep Learning is generated by the composition of functions. Unfortunately, the tools regarding the understanding of the discrete composition of functions are quite limited.
Moreover, considering $b^k=0$, we have that $F(x) = \sigma \circ A_T \circ \sigma \circ A_{T-1} \circ … \circ \sigma A_0 \circ x$. The gradient would then go as $\nabla_\theta F \sim A_T \cdot A_{T-1} \cdot … \cdot A_0 \sim k^L$. For $L$ large, the gradients would become very large or very small, and so training would not be feasible by gradient descent.
This is one of the reasons for introduction the Residual Neural Networks.
Residual Neural Networks
In the simple case of a Residual Neural Network (often referred to as ResNets) the functions $f_{\theta_k}^{k} (\cdot)$ are constructed as
where $\mathbb{I}$ is the identity function. The parameters $\sigma$, $A^k$ and $b^k$ are equivalent to those of the multilayer perceptrons.
We will see that it is sometimes convenient to numerically add a parameter $h$ to the residual block, such that
being $h \in \mathbb{R}$ a scalar.
Diagram of a ResNet, in a graph manner. Again, an algebraic representation is preferred.
Visualizing Perceptrons
The Neural Networks then represent the compositions of functions $f$, which consist on an affine transformation plus a nonlinearity.
If we use the activation function $\sigma ( \cdot ) = tanh (\cdot)$, then each function $f$ (and so each layer of the Neural Network) is first rotating and translating the original space, and then “squeezing” it.
Example of the transformation of a regular grid by a perceptron.
Binary classification with Neural Networks
When dealing with data classification, it is very useful to just assign a color / shape to every label, and so be able to visualize data in a lower-dimensional plot.
The aim of classification is to associate different classes to different regions of the initial space,
When using Neural Networks, the initial space $X$ is propagated by the Neural Network as $F = f ^L \circ f^{L-1} \circ … \circ f^1 (X)$.
Then the function $\phi$ would divide the space by an hyperplane, associate $0$ to one region and $1$ to the other.
So, while it may be difficult to classificate the datapoints in the initial space $X$, the Neural Networks should make things simpler and just propagate the data so as to make it linearly separable (and we would see this in real action!).
Our aim is therefore to transform the initial space $X$ in such a way that $M^0$ and $M^1$ are linearly separable. That is,
is linearly separable from
.
Example of the transformation of a regular grid by a perceptron.
Neural Networks as homeomorphisms
We know that the composite of continuous functions is continuous, and that the composite of bijections is a bijection. Then, a *Neural Network would represent a bijection if and only if all of its layers represent bijections. And, if the inverse is continuous, it would also be an homeomorphism.
In the case of multilayer perceptrons, since they are given by $f^L \circ f^{L-1} \circ … \circ f^1 (\cdot)$, they will represent an homeomorphism if each $f$ is an homeomorphism [5] [6].
$f = \sigma (A (\cdot) + b)$
In the case $\sigma = tanh$, restricting to our domain, we have a continous inverse.
Then it is enough that $A (\cdot) + b$ is homeomorphic. If $A$ is nonsingular, we know that there is an inverse function. Therefore, in the case of multilayer perceptrons, it is enough that all the matrices $A^k$ are nonsingular for the Neural Network to represent an homeomorphism.
Indeed, since the matrices $A^k$ are initialized at random, it is possible that some of them are singular, and so that the Neural Network does not represent an homeomorphism, but rather a function in which we “lose information” in the way by setting some directions to $0$. This has to do with the fact that arbitrarily large multilayer perceptrons are difficult to use in practice, and this is another reason why ResNets were introduced.
In the case of ResNets, all the functions
should be homeomorphisms. But in this case is more tricky than in the multilayer perceptrons case.
Theorem 1 (Sufficient condition for invertible ResNets [1]):
Let
$\hat{\mathcal{F}} \, : \, \mathbb{R}^{d} \rightarrow \mathbb{R}^{d}$ with
denote a ResNet with blocks defined by
Then, the ResNet $\hat{\mathcal{F}}_{\theta}$ is invertible if
We expect the lipschitz constant of $g_\theta$ to be bounded, and so $h\to 0$ would make our ResNets invertible.
Neural Networks and Dynamical Systems
From what we have seen, now the relation between Neural Networks and Dynamical Systems is just a matter of notation!
-
Consider the multilayer perceptron, given by
Simply renaming the index $l$ by the index $t-1$, and $L$ by $T-1$, we see that
If we define $x_t = f^t \circ … \circ f^0 (x)$, we see that what the neural network is doing is defining a dynamical system in which our initial values, denoted by $x$, evolve in a time defined by the index of the layers.
However, this general discrete maps are not easy to characterize. We can see that we are more lucky with ResNets.
-
In the case of Residual Neural Networks, the residual blocks are given by
where the supindex in $A$ and $b$ denote that $A$ and $b$, in general, change in each layer.
Defining the function $G(x, t) = (A^t (x) + b^t)/h$, we can rewrite our equation as
with the initial condition given by our input data (the ones given by the dataset).
Remember that the index $t$ refers to the index of the layer, but can be now easily interpreted as a time.
In the limit $h\to 0$ it can be recasted as
and, since the discrete index $t$ becomes continuous in this limit, it is useful to express it as
This dynamic should be such that $x(0)$ is the initial data, and $x(T)$ is a distribution such that the points that were in $M^0$ and $M^1$ are now linearly separable.
Therefore the ResNet architecture can be seen as the discretization of an ODE, and so the input points $x$ are expected to follow a smooth dynamics layer-to-layer, if the residual part is sufficiently small.
The question is: is the residual part sufficiently small? Is $h$ indeed small? There are empirical evidence showing that, as the number of layers ($T$) incresases, the value $h$ gets smaller and smaller.
But we do not need to worry too much, since we can easily define a general kind of ResNets in which the residual blocks are given by
in which $h$ could be absorbed easily by $A$ and $b$.
Deep Learning and Control
Recovering the fact that $f^t$ are indeed $f^t( \cdot ;\theta ^t)$, where $\theta^t$ are the parameters $A^t$ and $b^t$, we can express our dynamical equations, in the case of resnets as
where $x(0)$ is our initial data point, and we want to control our entire distribution of initial datapoints into a final suitable distribution, given by $x(T)$. In the case of binary classification, that “suitable distribution” would for example consist in one in which the datapoints labelled as $0$ move further away from the datapoints labelled as $1$, yielding a final space that could be separated by an hyperplane.
Exploiting this idea, we have the Neural Ordinary Differential Equations [10].
Visualizing Deep Learning
In a binary classification problem using Deep Learning, we essentially apply the functions $f\in \mathcal{H}$, where $\mathcal{H}$ has been previously defined, to our input points $x$, and then the space $f(x)$ is divided by two by an hyperplane: one of the resulting subspaces would be classified as $0$, and the other as $1$.
Therefore, our problem consists on making an initial dataset linearly separable.
Consider a binary classification problem with noisless data, such that
We consider two distributions, the ring distribution and the spiral distribution.
Plot of the ring and spiral distribution.
And let’s put into practice what we have learned! For that, we use the library TensorFlow [14], in which we can easy implement the Multilayer Perceptrons and Residual Neural Networks that we have defined.
We are going to look at the evolution of $x(t)$, with $x(0)$ the initial datapoint of the dataset. Remember that we have two cases
- In a multilayer perceptron, $x(t) = x_t = f^t \circ f^{t-1} \circ … \circ f^1(x)$.
- In a ResNet, $x(t)$ would be given by $x(t+1) = x(t) + f(x(t))$ that is, approximately, $\dot{x}(t) = G(x(t), t)$.
Multilayer Perceptrons
In the case of multilayer perceptrons, we choose $3$ neurons per layer. This means that we are working with points $x(t)$ in $\mathbb{R}^3$.
We train the networks, and after lots of iterations of the gradient descent method, this is what we obtain.
We see that in the final space (hidden layer 5) the blue and yellow points can be linearly separable.
However, the dynamics is far from smooth, and we see that in the final layers we seem to occupy a $2-$dimensional space rather than a $3-$dimensional one. This is because multilayer perceptrons tend to “lose information”. This type of behaviour causes that if we had increased the number of layers this architectures would be super difficult to train (we would have to try lots of times, since each time we initialize the parameters at random).
Visualizing ResNets
With ResNets we are far luckier!
Consider two neurons per layer. That is, we would be working with $x(t)$ in $\mathbb{R}^2$.
We observe that altough the spiral distribution can be classified by this neurons (the transformed space, in hidden layer $49$, makes the distribution linearly separable) this does not happen with the ring distribution!
We should be able to respond why this happens with what we have learned: since the ResNets are homeomorphisms, we would not be able to untie the tie in the ring distribution!
However, we should be able to untie it if going to a third dimension. Let’s try that.
Now we consider $3$ neurons per layer, i.e. $x(t) \in \mathbb{R}^3$.
Now both distributions can be classified. Indeed, every distribution in a plane could be in principle classified by a ResNet, since at most we would have ties of order $2$, that can be untied in a dimension $3$.
But could indeed all distributions be classified? Are the ResNets indeed such powerful approximators that we could recreate almost any dynamics out of them? Are we able to find the parameters $\theta$ (that can be seen as controls) such that all distributions can be classified? What do we gain by increasing $T$ (having more and more layers)?
Those and far more other questions arise out of this approach. And those cannot be answered easily without further research.
Results, open questions and perspectives
Noisy vs noisless data
Representation of a more natural distribution at the left, and examples of realisations of that distribution in the right.
It seems like we almost forgot that the data is (always) noisy! What happens in that case?
Considering the distribution in the figure (that can be seen as a more “natural” ring distribution), if we only cared about moving the blue points to the top, and the yellow points to the bottom, we would have an inecessary complex dynamics, since we expect some points to be mislabelled.
We should stick to “simple dynamics”, that are the ones we expect would generalise well. But how to define “simple dynamics”?
In an optimal control approach, this has to do with adding regularization terms.
Moreover, Weinan E. et al [2] propose the approach of considering, instead of our points $x(t)$ as objects of study for the dynamics, the probabilty distribution, and so recasting the control as a mean field optimal control. With this approach, some we gain some insight into the problem of generalization.
This has to do with the idea that indeed what the Neural Networks take as inputs are probabilty distributions, and the dynamics should be focused on those. In here theories such as transportation theory try to give some insight into happens when consider the more general problem of Deep Learning: one in which we have noise.
Complexity and control of Neural Networks
We also do not know what happens when increasing the number of layers. Why increasing the number of layers is better?
In practice, having more layers (working in the so called overparametrization regime) seems to perform better in training. Our group indeed gave some insight in that direction [15] by connecting this problems with the turnpike phenomenon [16].
Regarding optimality, it is not easy to define, since we have multiple possible solutions to the same problem. That is, there are multiple dynamics that can make an initial distribution linearly separable.
Dynamics given by a ResNet with 3 neurons per layer, with two different initializations.
The question is again: if there is a family of dynamics that solve the classification problem, which ones out of that family are optimal?
It also seems that one should take into account some problem of stochastic control, since the parameters $\theta$ are initialized at random, and different initializations give different results in practice. Moreover, the stochastic gradient descent, which is widely used, introduces some randomness to our problem. This indicates that Deep Learning is by no means a classical control problem.
Conclusions
Altough the problem of Deep Learning is not yet resolved, we have made a some very interesting equivalences:
- The problem of approximation in Deep Learning is now the problem of how is the space of possible dynamics? In the case of multilayer perceptrons, we can make use of discrete dynamical systems to solve that, or characterize their complexity; and in the case of ResNets, papers such at the one by Q. Li et. deals with that question [7].
- The problem of optimization is the problem of finding the best weights $\theta$, that can be recasted as controls. That is, is a problem of optimal control, and we should be able to use our knowledge of optimal control (for example, the method of succesive approximations) in this direction.
- The generalization problem can be understood by consdering the control of the whole probability distribution, instead of the risk minimization problem [2].
All in all, there is still lot of work to do to understand Deep Learning.
However, the presented approaches have been giving very interesting results in the recent years, and everything indicates that they will continue to do so.
References
[1] J. Behrmann, W. Grathwohl, R. T. Q. Chen, D. Duvenaud, J. Jacobsen (2018). Invertible Residual Networks arxiv
[2] Weinan E, Jiequn Han, Qianxiao Li, (2018). A Mean-Field Optimal Control Formulation of Deep Learning. volume 6. Research in the Mathematical Sciences. paper
[4] B. Hanin, (2018). Which Neural Net Architectures Give Rise to Exploding and Vanishing Gradients? arxiv
[5] C. Olah, Neural Networks, Manifolds and Topology . blog post
[6] G. Naitzat, A. Zhitnikov, L-H. Lim, (2020). Topology of Deep Neural Networks arxiv
[7] Q. Li, T. Lin, Z. Shen, (2019). Deep Learning via Dynamical Systems: An Approximation Perspective arxiv
[8] B. Geshkovski, The interplay of control and deep learning . blog post
[9] C. Fefferman, S. Mitter, H. Narayanan, Testing the manifold hypothesis . pdf
[10] R. T. Q. Chen, Y. Rubanova, J. Bettencourt, D. Duvenaud, (2018). Neural Ordinary Differential Equations arxiv
[11] G. Cybenko. Approximation by Superpositions of a Sigmoidal Function pdf
[12] Weinan E, Chao Ma, S. Wojtowytsch, L. Wu. Towards a Mathematical Understanding of Neural Network-Based Machine Learning_ what we know and what we don’t. arxiv
[14] Introduction to TensorFlow . tutorial
[15] C. Esteve, B. Geshkovski, D. Pighin, E. Zuazua Large-time asymptotics in deep learning . arxiv
[16] Turnpike in a Nutshell . Collection of talks


Initializes a new instance of the TelegramApi class.
The NationStates API instance used by this API. Only this API should use this instance.
The telegram client key used by this API.
The number of seconds between refreshes for a telegram job with the refresh option enabled. Defaults to 60.
Gets the NationStates API instance used by this API.
Gets whether or not existing telegrams in the queue are blocked from being sent.
If set to true, blocks the API from sending any further telegrams. If set to false, normal operation will resume.
Whether or not existing telegrams in the queue should be blocked from being sent.
Gets whether or not new telegrams are blocked from being added to the queue.
If set to true, prevents any new telegrams from being added to the queue. If set to false, normal operation will resume.
Whether or not new telegrams should be blocked from being added to the queue.
Gets the telegram client key used by this API.
Gets the event handler called when the API finishes sending telegrams for a particular job.
The new event handler.
Sets the event handler called when the API finishes sending telegrams for a particular job.
The new event handler.
Gets the event handler called when the API begins sending telegrams for a particular job.
Sets the event handler called when the API begins sending telegrams for a particular job.
The new event handler.
Gets the event handler called when new recipients are added to a job.
The new event handler.
Sets the event handler called when new recipients are added to a job.
The new event handler.
Gets the event handler called when the API fails to send a telegram to a recipient.
The new event handler.
Sets the event handler called when the API fails to send a telegram to a recipient.
The new event handler.
Gets the event handler called when the API successfully sends a telegram to a recipient.
The new event handler.
Sets the event handler called when the API successfully sends a telegram to a recipient.
The new event handler.
Gets the number of seconds between refreshes for a telegram job with the refresh option enabled.
Gets whether or not this API is currently sending telegrams.
Gets whether or not telegrams are queued.
Cancels the job with the specified ID.
The ID of the job to cancel.
Cancels all requests in the telegram queue and turns off the API scheduler.
After this function is called, no further telegrams can be sent using this API instance, including telegrams currently in the queue.
Cancels all requests in the API queue.
Creates a job with the specified parameters.
The TRL string.
Information about the telegram to send.
Whether the list of recipients should be refreshed by re-evaluating the TRL string at periodic intervals.
Rules for when to override API caching when re-evaluating a TRL string during a refresh.
Whether to not actually send any telegrams to the specified recipients.
A promise returning the created telegram job.
Parses and evaluates a TRL string.
A TRL string.
A promise returning the nations represented by the specified TRL string.
Gets the telegram job with the specified ID.
The telegram job ID.
The telegram job with the specified ID.
Called when a recipient entry in the queue is processed in order to determine if a job is complete.
The job associated with the recipient.
Called when an attempt is made to send a telegram to the specified recipient that fails.
The specified recipient.
The error associated with the failure.
Called when a telegram is sent successfully to the specified recipient.
The specified recipient.
Sends a telegram to the specified recipient.
The specified recipient.
Sends a telegram to the specified recipient.
The specified recipient.
Sends telegrams to the recipients defined by the specified template recipient language string.
The TRL string.
Information about the telegram to send.
Whether the list of recipients should be refreshed by re-evaluating the TRL string at periodic intervals. Defaults to false.
Rules for when to override API caching when re-evaluating a TRL string during a refresh. By default, all primitives override caches except categories and census.
Whether to not actually send any telegrams to the specified recipients. Defaults to false.
A promise returning the ID of the telegram job associated with this request.
Throws an error if the specified TRL string is not valid.
A TRL string.
Generated using TypeDoc
Sends telegrams to a list of NationStates nations defined using a powerful query language called Telegram Recipient Language.


Class MaterialSegmentedControl
DEPRICATED: USE SegmentedControl
Inherited Members
Namespace: Forms9Patch
Assembly: Forms9Patch.dll
Syntax
public class MaterialSegmentedControl : SegmentedControl, ILayout, IBackground, IShape, IElement, IDisposable, ILabelStyle, IFontElement
Implements
IDisposable


Service Marketplace
- Template Viewer
- Archetype Viewer (soon!)
- Clinical Document Instance Generator (random data XML)
- Clinical Document Instance Generator (tagged XML)
- Clinical Document Instance Generator (random data JSON)
- Bulk Clinical Document Instance Generator (soon!)
- Clinical Document Instance Validator
- HTML Form Generator
- Template to JSON
- Template Comparator (soon!)
- Template Repository (soon!)
- HTML Clinical Document Render
Template Viewer
This service allows to upload an openEHR Operational Template (OPT), display it's tree structure, and access useful technical information on each node, like Reference Model Class, Archetype ID, Path, and Constraints.
Clinical Document Instance Generator XML
This service generates Clinical Document Instances compliant with the openEHR XML Format, from a given Operational Template (OPT). This is very useful while testing applications.
Clinical Document Instance Generator JSON
This service generates openEHR Clinical Document Instances in JSON, from a given Operational Template (OPT). This is very useful while testing applications.
Clinical Document Instance Validator
This service allows to upload a clinical document in the openEHR XML Format, and execute a sintactic validation, returning a list of errors if something is not correct.
HTML Form Generator
This service allows to generate HTML Forms for data input from openEHR Operational Templates (OPT). This is useful for quick prototyping of clinical data recording apps.
Template to JSON
This service allows to transform openEHR Operational Templates (OPT) in XML to an equivalent JSON structure. This is very useful to work with OPTs in the front-end and JavaScript frameworks.
Your title card
Your description card dfghdf gdfgh dfgh dfg hdfg hdfd gh dfgh dd fghdfgh df fd ghfgh dfgh dfgfd hdfgh.
Your title card
Your description card dfghdf gdfgh dfgh dfg hdfg hdfd gh dfgh dd fghdfgh df fd ghfgh dfgh dfgfd hdfgh.
Card title
Some quick example text to build on the card title and make up the bulk of the card's content.
- Cras justo odio
- Dapibus ac facilisis in
- Vestibulum at eros
Special title treatment
With supporting text below as a natural lead-in to additional content.
Go somewhere


4.2.2 : Or
Now that we've done a simple one input one output inversion, let's move onto two inputs one output. OR is an operator that renders true when at least one of two statements is true. Let's consider the weather. It is a good day if "The sky is blue" OR "It is sunny". If the sky is blue and it's not sunny, it's still a good day. If the both the sky is blue and it is sunny, then it's a good day. Let's set up a truth table and further analyze this operator. Our truth table now has 4 rows. If you look closely, the rows count upwards, 0 1 2 3 in binary. Whenever you set up a truth table, this is the best way to do it.
Notation: x + y , x ∨ y
| x | y | x ∨ y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
In regular algebra, OR is comparable to addition. Let's think of adding 0 and random positive values. The only way to get 0 from adding not negative values is to add 0 and 0. If we add 0 to any positive value, we get that positive value. If we add two positive values, we got a different positive value. This is similar to how when performing OR, the only way to get F is to have all values be False. One of the notations for OR is the plus sign (+) just as addition.
We see a similar relation to addition in set theory. A union of two sets is all the elements in both sets. I included a venn diagram below. The highlighted in blue is what would be in the union of A and B. Once again, the union is everything in A added to everything in B. The symbol for union (∪) also looks very similar to that of OR (∨).
Practice Problem
If y is false and (x ∨ y) is true, what is x?


Build Your Order
Produce
Select...
Tomato (case)
Squash (case)
Onion (case)
Quantity
Add Item
Product
Quantity
Delivery Date
Submit My Order
You will have a chance to review your order before it is final.


AESCipher
public class AESCipher: NSObject, BlockCryptor
AES encryption/decryption class
-
AES encryption/decryption class
Declaration
Swift
public var coreCryptor: CoreCryptor
-
Initialization vector (get only)
Declaration
Swift
public var iv: Data?
-
Encryption key (get only)
Declaration
Swift
public var key: Data?
-
Creates new AESCipher object with encryption key, initialization vector and block cipher mode
Declaration
Swift
public init(key: Data, iv: Data, blockMode: AESBlockCipherMode) throws
Parameters
key
Encryption/decryption key
iv
Initialization vector
blockMode
AES block mode


Money Play. How should Red play 44?
pips Red=127 White=170
(CorrectAnswer= 0/0, ErrorScore= 0)
White's timing is precarious so Red should not improve it by hitting the blot on the 17-pt although this would be many players first instinct. White's board is not strong enough to make hitting a necessity.
After bar/21 making the 4-pt is the natural play with two more fours becauset hat is the point Red most wants to make.
The fourth four could be played 9/5 but making the 9-pt is stronger, effectively creating a partial prime in front of White's checkers on Red's 3-pt.
So the correct play is bar/21, 13/9, 8/4(2). Bar/21, 9/5, 8/4(2) is not quite an error but any other play is at least an error.
After bar/21 making the 4-pt is the natural play with two more fours becauset hat is the point Red most wants to make.
The fourth four could be played 9/5 but making the 9-pt is stronger, effectively creating a partial prime in front of White's checkers on Red's 3-pt.
So the correct play is bar/21, 13/9, 8/4(2). Bar/21, 9/5, 8/4(2) is not quite an error but any other play is at least an error.
1. Cubeful 2-ply 13/7(2) Eq.: +0.529 0.653 0.124 0.004 - 0.347 0.069 0.002 2. Cubeful 2-ply 13/7 10/7 5/2 Eq.: +0.482 (-0.048) 0.653 0.100 0.002 - 0.347 0.067 0.001 3. Cubeful 2-ply 18/15(2) 10/4 Eq.: +0.454 (-0.076) 0.652 0.061 0.001 - 0.348 0.048 0.000 4. Cubeful 2-ply 18/15(2) 13/10 5/2 Eq.: +0.453 (-0.076) 0.654 0.060 0.001 - 0.346 0.054 0.000 5. Cubeful 2-ply 18/15(2) 13/10(2) Eq.: +0.389 (-0.141) 0.622 0.084 0.003 - 0.378 0.074 0.001