File:MYCIN certainty factors combination.svg

Original file (SVG file, nominally 768 × 768 pixels, file size: 61 KB)

Summary

Description
English: MYCIN certainty factors combination contour plot.

Matplotlib code

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import TwoSlopeNorm

def cf_combine(x, y):
    """MYCIN certainty factor combination formula"""
    if x > 0 and y > 0:
        return x + y - x*y
    elif x < 0 and y < 0:
        return x + y + x*y
    else:
        min_abs = min(abs(x), abs(y))
        if min_abs == 1:  # Handle division by zero case
            return np.nan
        return (x + y)/(1 - min_abs)

# Create a grid of x and y values
n = 200
x = np.linspace(-1, 1, n)
y = np.linspace(-1, 1, n)
X, Y = np.meshgrid(x, y)

# Calculate Z values using the combination formula
Z = np.zeros((n, n))
for i in range(n):
    for j in range(n):
        Z[i, j] = cf_combine(X[i, j], Y[i, j])

# Create figure and axes with 1:1 aspect ratio
fig, ax = plt.subplots(figsize=(8, 8))

# Contour plot
levels = np.linspace(-1, 1, 21)
im = ax.contour(X, Y, Z, levels=levels, cmap='RdBu')
ax.clabel(im, inline=True, fontsize=8)
ax.set_title('Contour Plot of MYCIN Certainty Factor Combination')

ax.grid(True, linestyle='--', alpha=0.6)
ax.axhline(y=0, color='k', linestyle='-', alpha=0.3)
ax.axvline(x=0, color='k', linestyle='-', alpha=0.3)
ax.set_aspect('equal') # Ensure 1:1 aspect ratio

plt.tight_layout()
plt.savefig('mycin_cf_combine.svg')
plt.show()

Date
Source Own work
Author Cosmia Nebula

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

3 November 2024

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current21:22, 3 November 2024Thumbnail for version as of 21:22, 3 November 2024768 × 768 (61 KB)Cosmia NebulaUploaded while editing "Mycin" on en.wikipedia.org

The following page uses this file:

Metadata