- Inductive bias
- Spazio delle ipotesi
$H$ con ipotesi$h \in H$ - version space, spazio delle ipotesi tra gli estremi di quelle consistenti
- Ad esempio spazio delle curve polinomiali, con obiettivo minimizzare:
$min_{w} 1/n \sum_{i=1}^n (y_i - wx_i)^2$ - Training/empirical error vs ideal error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(non_snake_case)] | |
fn init_array<const M: usize, const N: usize>( | |
A: &mut [[f32; N]; M], | |
r: &mut [f32; M], | |
p: &mut [f32; N], | |
) { | |
for i in 0..N { | |
p[i] = (i % N) as f32 / N as f32; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>; | |
export type ValueOf<T> = T[keyof T]; | |
export function assertNever(_: never): never { | |
throw new Error('Unreachable code'); | |
} | |
export function debounce<F extends (...params: Array<any>) => void>(fn: F, delay: number): F { | |
let timer: NodeJS.Timeout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Determine the intersection of a segment, having ad edge in the center of circle, | |
* with the circle itself | |
*/ | |
function intersect( | |
xc: number, | |
yc: number, | |
radius: number, | |
x1: number, | |
y1: number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Determine the intersection point of two line segments, but considering also | |
* colinear segments as intersection | |
* @see {@link http://paulbourke.net/geometry/pointlineplane/} | |
*/ | |
function intersect( | |
x1, y1, x2, y2, | |
x3, y3, x4, y4 | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* TS porting of https://stackoverflow.com/questions/20453545/how-to-find-the-nearest-point-in-the-perimeter-of-a-rectangle-to-a-given-point | |
*/ | |
function clamp(x: number, lower: number, upper: number): number { | |
return Math.max(lower, Math.min(upper, x)); | |
} | |
export function getNearestPointInPerimeter( | |
l: number, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Stream where | |
import Stream.Internal | |
import Debug.Trace | |
import Control.Arrow | |
import Control.Applicative | |
-- | Get the first element of a stream. | |
headS :: Stream a -> a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copyStyles(sourceDoc, targetDoc) { | |
Array.from(sourceDoc.styleSheets).forEach(styleSheet => { | |
if (styleSheet.cssRules) { // for <style> elements | |
const newStyleEl = sourceDoc.createElement('style'); | |
Array.from(styleSheet.cssRules).forEach(cssRule => { | |
// write the text of each rule into the body of the style element | |
newStyleEl.appendChild(sourceDoc.createTextNode(cssRule.cssText)); | |
}); |
NewerOlder