जाली आधारित मॉडल के साथ लचीला, नियंत्रित और व्याख्या योग्य एमएल

import numpy as np
import tensorflow as tf
import tensorflow_lattice as tfl

model = tf.keras.models.Sequential()
model.add(
    tfl.layers.ParallelCombination([
        # Monotonic piece-wise linear calibration with bounded output
        tfl.layers.PWLCalibration(
            monotonicity='increasing',
            input_keypoints=np.linspace(1., 5., num=20),
            output_min=0.0,
            output_max=1.0),
        # Diminishing returns
        tfl.layers.PWLCalibration(
            monotonicity='increasing',
            convexity='concave',
            input_keypoints=np.linspace(0., 200., num=20),
            output_min=0.0,
            output_max=2.0),
        # Partially monotonic categorical calibration: calib(0) <= calib(1)
        tfl.layers.CategoricalCalibration(
            num_buckets=4,
            output_min=0.0,
            output_max=1.0,
            monotonicities=[(0, 1)]),
    ]))
model.add(
    tfl.layers.Lattice(
        lattice_sizes=[2, 3, 2],
        monotonicities=['increasing', 'increasing', 'increasing'],
        # Trust: model is more responsive to input 0 if input 1 increases
        edgeworth_trusts=(0, 1, 'positive')))
model.compile(...)

TensorFlow Lattice एक पुस्तकालय है जो विवश और व्याख्यात्मक जाली आधारित मॉडल लागू करता है। पुस्तकालय आपको सामान्य ज्ञान या नीति-संचालित आकार बाधाओं के माध्यम से सीखने की प्रक्रिया में डोमेन ज्ञान को इंजेक्ट करने में सक्षम बनाता है। यह केरस परतों के संग्रह का उपयोग करके किया जाता है जो एकरसता, उत्तलता और सुविधाओं के इंटरैक्ट जैसे बाधाओं को पूरा कर सकता है। पुस्तकालय प्रीमेड मॉडल और डिब्बाबंद अनुमानक स्थापित करने में आसान भी प्रदान करता है।

टीएफ लैटिस के साथ आप डोमेन ज्ञान का उपयोग प्रशिक्षण डेटासेट द्वारा कवर नहीं किए गए इनपुट स्पेस के उन हिस्सों को बेहतर ढंग से एक्सट्रपलेशन करने के लिए कर सकते हैं। यह अप्रत्याशित मॉडल व्यवहार से बचने में मदद करता है जब सर्विंग वितरण प्रशिक्षण वितरण से अलग होता है।