We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

EuroSciPy 2017: SciPy

00:00

Formal Metadata

Title
EuroSciPy 2017: SciPy
Title of Series
Number of Parts
43
Author
Contributors
License
CC Attribution 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language
Production PlaceErlangen, Germany

Content Metadata

Subject Area
Genre
5
Thumbnail
1:34:10
33
Thumbnail
1:31:57
34
Thumbnail
1:28:12
35
Thumbnail
1:27:32
41
Thumbnail
1:31:21
43
InformationLevel (video gaming)Mathematical optimizationDisintegrationInterpolationComputer-generated imageryRandom numberNumberFourier seriesOperations researchAlgebraLinear mapImage processingInclusion mapDigital signal processingSample (statistics)CodeBit rateNumerical analysisTask (computing)Modul <Datentyp>Latent heatGeometric quantizationIdeal (ethics)Matrix (mathematics)Sparse matrixLogical constantCoroutineFunction (mathematics)outputLinear regressionOrthogonalityData structureCovering spaceLibrary (computing)NP-hardPhysicistMultiplication signNamespaceWeb pageMaterialization (paranormal)Flow separationRevision controlMereologyNumeral (linguistics)Analytic setElectronic mailing listModule (mathematics)Numerical analysisTheoryVideo gameDiscrete groupGoodness of fitComputer animation
System callKernel (computing)LogarithmCellular automatonCodeInverse hyperbolic functionGeometric quantizationLogical constantFourier seriesoutputFunction (mathematics)AlgebraCoroutineLinear mapComputer-generated imageryLinear regressionOrthogonalityMathematical optimizationDigital signal processingData structureBit rateInterpolationModul <Datentyp>Task (computing)Latent heatDisintegrationMatrix (mathematics)Sparse matrixData dictionaryComputer fileKey (cryptography)Bridging (networking)Row (database)Machine visionGoodness of fitBitMedical imagingLatin squareWebsitePhysicalismOffice suiteSingle-precision floating-point formatSoftwareMultiplication signObservational studyDistanceEuklidischer RaumDifferent (Kate Ryan album)InformationSparse matrixLinear regressionOrthogonalityDimensional analysisNichtlineares GleichungssystemCovering spaceLogical constantCodeRepresentation (politics)Gene clusterDirection (geometry)Category of beingEvoluteInterpolationNumeral (linguistics)Vector spaceFunction (mathematics)Arrow of timeDisplacement MappingSignal processingFourier transformMathematical physicsAlgebraLinearizationComputer animation
Cellular automatonInverse hyperbolic functionKernel (computing)CodeLaptopComputer fileGradientOverhead (computing)Computational physicsNewton's methodParameter (computer programming)Disk read-and-write headFunction (mathematics)Performance appraisalClique-widthKeilförmige AnordnungMeasurementLatent heatComputer-generated imageryStructural loadoutputModule (mathematics)AreaIntegerJacobi methodGamma functionNumerical analysisLinear mapAlgebraOperations researchElectronic mailing listInverse elementComputerDeterminantSquare numberMatrix (mathematics)System callMeta elementComputer fileLogic gateTotal S.A.Electronic mailing listPoint (geometry)Matrix (mathematics)Object (grammar)DeterminantLinear algebraInterface (computing)Multiplication signDivisorDifferent (Kate Ryan album)Goodness of fitImage processingFunction (mathematics)Compilation albumMathematicsWordBitProteinCASE <Informatik>LengthLinearizationFunctional (mathematics)Gamma functionMedical imagingTerm (mathematics)Electronic visual displayMappingFlow separation1 (number)Variable (mathematics)Dimensional analysisStructural loadSuite (music)Labour Party (Malta)Digital electronicsStandard deviationCondition numberVideo gameCovering spaceResultantAreaInsertion lossLibrary (computing)Bit rateConcentricElectric generatorFormal languageQuicksortText editorRight angleGame theoryWebsiteVirtual machineLevel (video gaming)Control flowVideoconferencingOpen sourceCausalityDegree (graph theory)View (database)AverageGoogolComputer animation
Matrix (mathematics)ComputerFunction (mathematics)Square numberDeterminantAreaLinear mapAlgebraOperations researchComputer fileCellular automatonKernel (computing)Inverter (logic gate)Inverse elementMathematical singularityInformationoutputSystem callDot productDiagonalParameter (computer programming)Matrix (mathematics)Parameter (computer programming)Diagonal matrixSparse matrixDiagonalData structureInverter (logic gate)DeterminantOperator (mathematics)Invertible matrixFunctional (mathematics)Library (computing)Linear algebraInverse elementMathematical singularityLinear equationPoint (geometry)CodeSingular value decompositionCASE <Informatik>Bit rateOpen sourcePlanningGoodness of fitPeer-to-peerMedical imagingImage resolutionAreaTheoryGame theoryBasis <Mathematik>BlogVideo gameResultantRule of inferenceOrder (biology)WordPressureMetropolitan area networkComputer animation
Bit rateMachine visionOperator (mathematics)Execution unitRevision controlEvelyn PinchingComputer configurationCAN busShared memoryMeasurementRight angleFile viewerVelocityMatrix (mathematics)InterpolationBitVector spaceImage resolutionLinearizationStandard deviationPosition operatorNeuroinformatikWell-formed formulaRotationSingular value decompositionLinear equationLinear algebraLecture/Conference
SineFunction (mathematics)Random numberInterpolationIntelLinear mapSystem callBound stateBroadcasting (networking)Data typeString (computer science)Computer filePoint (geometry)Plot (narrative)Event horizonZirkulation <Strömungsmechanik>Computer configurationExtreme programmingExtrapolationMetropolitan area networkLine (geometry)AreaLogic gateRecurrence relationAverageNichtlineares GleichungssystemGoodness of fitRevision controlWeb pageObject (grammar)Adventure gameInformationRule of inferenceOvalPoint (geometry)Disk read-and-write headOperator (mathematics)Functional (mathematics)Range (statistics)InterpolationSlide ruleLinearizationCodeRight angleNumberMultiplication signMeasurementDefault (computer science)Parameter (computer programming)Hydraulic jumpOrder (biology)Cubic graphInstance (computer science)Figurate numberComputer animation
Plot (narrative)Point (geometry)InterpolationLinear mapPell's equationInverter (logic gate)Hausdorff dimensionMathematical analysisStatisticsSpectroscopyRandom numberAlgorithmData structureSigma-algebraDomain nameImage resolutionApproximationInformationPredictionDatabase transactionGlattheit <Mathematik>Mathematical optimizationCluster samplingData modelServer (computing)Newton's methodComputational physicsOverhead (computing)Parameter (computer programming)GradientDisk read-and-write headFreewareFunction (mathematics)Performance appraisalMeasurementLaptopKernel (computing)Directory serviceMilitary operationTheory of relativityGenderWordInterpolationWindowContent (media)Computer animation
Kernel (computing)LaptopE-bookServer (computing)Directory serviceOpen setDigital filterComputer fileComputer-generated imageryLevel (video gaming)InformationMilitary operationRevision controlUser profileDefault (computer science)Physical systemControl flowFlash memoryCluster samplingInterpolationParameter (computer programming)Workstation <Musikinstrument>Spline (mathematics)Point (geometry)Maxima and minimaArray data structurePredictionStatisticsSimilarity (geometry)IntelMathematical optimizationFunction (mathematics)Module (mathematics)SineDifferent (Kate Ryan album)Decision theoryAverageElectronic mailing listSurface of revolutionOperator (mathematics)Interpreter (computing)Client (computing)Game theoryAreaDevice driverLibrary (computing)Forcing (mathematics)ForestCoroutine1 (number)Revision controlVideo gameINTEGRALMathematical optimizationHill differential equationData recoverySpline (mathematics)CASE <Informatik>Goodness of fitDifferential (mechanical device)Instance (computer science)InterpolationMoment (mathematics)SurfaceCategory of beingMereologyFunctional (mathematics)Figurate numberMaxima and minimaWaveMultiplication signCurve fittingForm (programming)MeasurementSet (mathematics)CoefficientSpline interpolationSinc functionComputer animation
CodeKernel (computing)Computer fileCellular automatonSquare numberRandom numberEmailSineNormal (geometry)Normed vector spacePlot (narrative)WaveMathematical optimizationSineWordLine (geometry)Functional (mathematics)Different (Kate Ryan album)Computer animation
Hill differential equationSquare numberFunction (mathematics)Cellular automatonKernel (computing)Random numberNormal (geometry)FrequencySineLaptopLetterpress printingPlot (narrative)Computer fileLine (geometry)Graph (mathematics)Functional (mathematics)Wrapper (data mining)PerimeterSoftware testingError messageFrequencyCASE <Informatik>Letterpress printingParameter (computer programming)Right angle2 (number)Population densitySpacetimePlotterAutocovarianceOptimization problemArithmetic meanWavePunched cardMathematical optimizationElectronic mailing listPoint (geometry)Maxima and minimaCurve fittingCodeObservational studyDistribution (mathematics)Quantum stateComputer configurationCondition numberTheoryResultantPosition operatorAuthorizationTraffic reportingLevel (video gaming)Revision controlWordInheritance (object-oriented programming)Machine visionFigurate numberMereologyWage labourPlastikkarteAverageGame theoryEuler anglesSoftware developerSound effectDifferent (Kate Ryan album)Group actionConcentricLie groupProcess (computing)OvalData storage deviceArithmetic progressionConnected spaceComputer animation
Function (mathematics)Plot (narrative)Extreme programmingFrequencyDegree (graph theory)RoutingAreaGroup actionGoodness of fitRepresentation (politics)Computer configurationMultiplication signShared memoryInheritance (object-oriented programming)Condition numberAlgorithmBitFitness functionDifferential (mechanical device)QuicksortOptimization problemStatisticsWaveEndliche ModelltheorieSineCuboidPoint (geometry)Complete metric spaceMathematical optimizationResultantComputer animation
Extreme programmingDegree (graph theory)Function (mathematics)Plot (narrative)FrequencyPC CardCurve fittingKernel (computing)Cellular automatonLetterpress printingSystem calloutputComputer fileWordGodImage resolutionVector spacePlotterMaxima and minimaWave2 (number)Execution unitFitness functionWeb pageDifferent (Kate Ryan album)AreaUniverse (mathematics)Lecture/ConferenceComputer animation
Cellular automatonComputer fileKernel (computing)System calloutputAttribute grammarModule (mathematics)Plot (narrative)Maxima and minimaLine (geometry)DataflowOvalWordArmWhiteboardData recoveryTraffic reportingPosition operatorFamilyFrequencyData managementResultantAreaLie groupMachine visionTheory of relativityTunisVector spaceSoftware testingMaxima and minimaAlgorithmFitness functionNumberSpacetimeSquare numberVirtual machineLengthAverageParameter (computer programming)MetreLine (geometry)Term (mathematics)WiMAXStudent's t-testSinePoint (geometry)Multiplication signComputer animation
Extreme programmingDegree (graph theory)Plot (narrative)Function (mathematics)Letterpress printingCurve fittingMaxima and minimaSineCellular automatonKernel (computing)LaptopPoint (geometry)InformationMessage passingMathematical optimizationComputer fileRevision controlConstraint (mathematics)Jacobi methodGradientBoolean algebraDuality (mathematics)Matrix (mathematics)Derivation (linguistics)Internet service providerProduct (business)AlgorithmComputer configurationDegree (graph theory)Event horizonDivision (mathematics)Machine visionArchaeological field surveyTouchscreenOrder (biology)Line (geometry)ResultantCASE <Informatik>Computer configurationWordPosition operatorAreaAdditionAverageInheritance (object-oriented programming)Goodness of fit40 (number)AuthorizationPoint (geometry)Service (economics)Food energyStructural loadDecision theoryString (computer science)Mathematical optimizationFunctional (mathematics)Maxima and minimaMultiplication signSoftware testingAlgorithmInformationDifferent (Kate Ryan album)Student's t-testGradientNumberSineBitAxiom of choiceDefault (computer science)Cost curveComputer animation
Cellular automatonKernel (computing)Computer fileMessage passingMathematical optimizationLaptopMaxima and minimaAlgorithmComputer configurationSmoothingFunction (mathematics)Gradient descentGradientNormed vector spaceLiquidCASE <Informatik>Multiplication signPerformance appraisalNumberFunctional (mathematics)CurveMathematical optimizationBitProjective planePurchasingRevision controlAreaComputer animationDiagram
Kernel (computing)Cellular automatonMathematical optimizationMaxima and minimaInclusion mapMessage passingComputer fileResolvent formalismFerry CorstenMusical ensembleSpeech synthesisWordSelf-organizationProcess (computing)CASE <Informatik>Machine visionCondition numberFunctional (mathematics)Mathematical optimizationMaxima and minimaMereologyPosition operatorComputer animation
Message passingComputer fileCellular automatonKernel (computing)Parameter (computer programming)Function (mathematics)Data typeString (computer science)Maxima and minimaAlgorithmIntegerIterationCoroutineSystem programmingSoftware testingRandom numberAdditionEscape characterAttribute grammarRadio-frequency identificationDerivation (linguistics)Hessian matrixMathematical optimizationRadical (chemistry)DatabaseOpen sourceImplementationBounded variationVariety (linguistics)Charge carrierDegree (graph theory)InformationLetterpress printingFood energySineCountingData storage deviceControl flowOperator (mathematics)Virtual machineSource codeRandom number generationMaxima and minimaFunctional (mathematics)Parameter (computer programming)Arithmetic meanRevision controlOptimization problemString (computer science)EncryptionOnline helpLibrary (computing)RandomizationDataflowProcess (computing)Musical ensembleElectric generatorResultantMoment (mathematics)Order (biology)Video gamePRINCE2WordRootMachine visionInstance (computer science)Computer animation
Maxima and minimaPoint (geometry)Mathematical optimizationRevision controlMessage passingCellular automatonComputer fileKernel (computing)Function (mathematics)Variable (mathematics)Vector spaceRandom numberNumberDisintegrationBit rateFourier seriesDigital signal processingComputer-generated imageryCodeSample (statistics)Modul <Datentyp>Task (computing)Latent heatGeometric quantizationNumerical analysisIdeal (ethics)Linear mapAlgebraOperations researchInterpolationInternet service providerTable (information)Scripting languageInterface (computing)Common Language InfrastructureSineSquare numberFrequencyNormal (geometry)Plot (narrative)Extreme programmingInformationComputer configurationSmoothingGradient descentSampling (music)IterationCoroutineElectronic mailing listFunctional (mathematics)Fraction (mathematics)Performance appraisalNumberRule of inferenceCovering spaceRootString (computer science)Open sourceMathematical optimizationComputer animation
Constraint (mathematics)Bound stateMaxima and minimaVariable (mathematics)Parameter (computer programming)Function (mathematics)Point (geometry)RootMessage passingVariety (linguistics)BootingNumberRandom numberModule (mathematics)StatisticsLinear mapCurve fittingSquare numberElectric generatorSimilarity (geometry)HistogramPopulation densityProcess (computing)Probability density functionNormal (geometry)Normed vector spaceDistribution (mathematics)Plot (narrative)Binary fileSample (statistics)Object (grammar)MedianEstimatorArithmetic meanData recoveryComplete metric spaceShape (magazine)Set (mathematics)Identical particlesOrder of magnitudeVisualization (computer graphics)Software testingDisintegrationCoroutineGeneric programmingQuadrilateralDistribution (mathematics)Different (Kate Ryan album)Set (mathematics)CumulantPermanentNumberStatisticsSampling (statistics)Software testingP-valueMaxima and minimaParameter (computer programming)Nichtlineares GleichungssystemINTEGRALMultiplication signMathematical optimizationPoint (geometry)Differential equationNormal (geometry)Gamma functionEstimatorNoise (electronics)ResultantObject (grammar)Likelihood functionDensity functional theoryNormal distributionRootUniform resource locatorStatistical hypothesis testingBound stateConstraint (mathematics)Right angleMedical imagingText editorForcing (mathematics)Direction (geometry)Ring (mathematics)MultilaterationRange (statistics)Bridging (networking)WordMereologyVideo gameTheory of relativityFamilyInheritance (object-oriented programming)Royal NavyCondition numberGroup actionChainAverageWebsiteInterior (topology)Electronic mailing listIdeal (ethics)Decision theoryDegree (graph theory)Student's t-testEncryptionRevision controlSlide ruleFigurate numberMachine visionLine (geometry)BitComputer animation
Position operatorFunction (mathematics)Physical systemDisintegrationFourier seriesModule (mathematics)ComputerFast Fourier transformoutputFrequencyInverse elementCodeDigital signal processingSineInterpolationInternet service providerSample (statistics)WindowComputer-generated imageryMusical ensembleSheaf (mathematics)Mathematical analysisDigital filterPopulation densityInfinityLinear mapDependent and independent variablesWiener filterTransformation (genetics)GeometryArray data structureShift operatorShape (magazine)RotationImage resolutionZoom lensStructural loadSquare numberHistogramTheoryHeat transferBinary fileAreaMassMeasurementFrictionSummierbarkeitPixelMaxima and minimaWordMoment (mathematics)Ocean currentFood energyOracleAreaSystem callOrder (biology)BitOffice suiteRow (database)Event horizonRing (mathematics)Green's functionClosed setDisk read-and-write headArithmetic progressionBoom (sailing)Power (physics)Graph coloringResultantNumberPerturbation theoryGroup actionVotingAuthorizationOperator (mathematics)Medical imagingFreewareSummierbarkeitSpectrum (functional analysis)MathematicsSet (mathematics)Binary imageConnectivity (graph theory)Mathematical morphologyFilter <Stochastik>Similarity (geometry)Patch (Unix)Thresholding (image processing)MedianPopulation densityFourier seriesImage processingPhysical systemSignal processingPixelForcing (mathematics)Shift operatorDifferent (Kate Ryan album)Object (grammar)Computer animation
CodeSample (statistics)Computer-generated imagerySmoothingFunction (mathematics)Maxima and minimaOrdinary differential equationDisintegrationMultiplication signComputer animation
Transcript: English(auto-generated)
So what we'll be seeing right now is sci-fi, the sci-fi module. So the sci-fi module is basically a large stack of numerical algorithms.
The reason it's important is it contains basic numerical algorithms, and these are things that you do not want to recode. There has been for a long time a tradition of recoding basic numerical algorithms,
especially if you're a physicist. When I did my PTO was told, you're just going to code these things because it will teach you luck, basically. That's a very bad idea because it's easy to do a bad version and hard to do a good version. So I think it's really important to go over the sci-fi library
just so that people know what's in there so that they can come back to it when they need it. So sci-fi contains a lot of things. It contains, it's organized in sub-modules.
So that's the list on the main... Well, no, that's actually the list of the sub-modules that I will cover. So I'll cover a lot of different sub-modules. And the danger, of course, is to get into a boring iteration, which I'll try to avoid.
And so we're going to be skipping through several topics of numerical analytics. Don't be worried. If you don't know anything about a climate or numerics, it's fine. And I'll confess that there are some parts where I feel maybe lousy.
I don't feel confident enough, so just to get you out of here. As a warning sign, we could do a whole introduction to numericals, which we will not. All right, so who does not have the material there?
Anyone? You don't have the materials, do you? Do you do? Oh, you have them in the vents? Okay, so it's a working-product version of the sci-fi materials
that is on my private webpage that I lost my declining a couple of hours ago. And there's also one or two drives that are running around with the material running.
Anybody else? To avoid this becoming too boring, please do interrupt me. Let's start to make this a discussion rather than an enumeration. So, the sci-fi in itself is composed of all-specific sub-modules.
Unlike, I guess, most of the packages that you've seen, nothing useful resides in the sci-fi namespace. There are things in the sci-fi namespace. Let's just quickly have a look.
So if we hit one sci-fi, and we have to be in sci-fi, there are lots of things. Lots and lots and lots and lots and lots of things. Don't use them. The reason being that this is historical, and these things are nothing but direct imports of sci-fi.
So let us not be confused. Let us use functions from sci-fi when they come from sci-fi, and functions from sci-fi when they come from sci-fi. So we will use the sub-values of sci-fi. There are a bunch of different sub-values, but a lot. And I won't cover all of them, but I'll make it new.
Just look at them quickly. We have some simple clustering that may be useful to do vector representation. We have a bunch of physical mathematical constants in sci-fi constants. We have Fourier transform that we'll cover in FFT pack,
or a BOS Fourier transform pack. We have numerical integrations, whether it's computing the integral of a function, or integrating a dimension equation. It integrates. We have sci-fi dot interpolate. There's a bunch of different interpolation movies. We have some audio routines in sci-fi.io.
We have linear algebra in linear algebra. We have simple image manipulation in MD image. It's called MD image because it works on all the jury images. If you have five dimension image, some people do. It will work.
We have orthogonal distance regression. I have never used it. Maybe I should look at it once. Optimization, we'll cover it. Signal processing. Sparse matrices, oh, we're not covering sparse matrices in this tutorial. Well, just keep in mind that if you ever need sparse matrices,
there are in sci-fi sports. We have spatial infrastructures. We're not going to cover them, but basically if you need to look at your neighbors in 2 or 3D, like if you're a record information assistant, or if you need to give you distances, all kinds of different distances, like the Euclidean distance,
but also the Hamming distance, the Manhattan distance. They're all available in sci-fi study. Spatial, there's sci-fi special, which is a special mathematical function that I'll cover in a minute, and we have basics of displacement. Okay? And there might be other things that I forgot to mention,
because this was done a few years ago, and I haven't checked it yet until about today. So, if you're all ready, let's get started, and let's look at sci-fi IO. And I don't have iBike in the book for the simple things,
because I want you at least to copy-paste. Maybe not type along, but at least to copy-paste. So, if you have a material, when there is a code example, you can click on the little arrows to make the outputs disappear. So, then it makes it really easy to copy-paste in the same iBike in the book,
or whichever one you prefer. Okay? Because what I'm trying to avoid is like the shift-enter tutorial, where people just run things by pressing shift-enter, and turn their brain off. So, now you can copy-paste and turn your brain off.
Evolution has taught human beings to be lazy. Alright. So, I'm going to bring this iBike in the book next to here,
and we're going to start copying-pasting. We need to apply a few things. Alright. So, the first thing we're going to look at is meta files.
So, I don't know why on Earth you would want to save a million meta files, but you can do it. And so, we're going to import sci-fi IO. So, we're going to...
Sorry, just talking this point of thought. Okay. So, we're going to import sci-fi IO, and we're going to create a 2D matrices of, a 2D array of ones. Okay? And then what we can do is we can save it into a meta file.
And meta files can do things several variables. So, what we do is we give a dictionary that maps variable names to what we want to save. So, basically we're saving the A array under the name A. Okay?
And then we can load it back and display it. Alright? So, we do this. What happens? Oh, I forgot the one point point.
Okay? So, there's one disclaimer, is that MATLAB doesn't support well 1D arrays, and MATLAB everything is 2D, because it thinks in terms of matrices.
So, if you do the same, and where the 1D array, that should let me, let me display the 1D array. So, we have 1D array here, and then we save it,
and load it back. Then what happens is it became 2D. Alright? That's kind of horrible. So, why on earth would you want to save meta files? I don't know. But just in case you need it. So, that's the first thing.
And the other thing that we can do with SciFi.io, well, actually it's SciFi.MISC, it moved to MISC, is read image files. So, we can do it.
So, if we have a file, if we have a PNG file, we can read it with in-ring. We can also use that method to do this, right? And so that's going to return, if it's a grayscale, it's going to return a 2D array, if it's a colored image, and it's going to return a 3D array, with the last dimension being the colors,
that is going to be length three or four, if you have transpose. Does that make sense? Does it really take make sense? It should be possible. Just in case it doesn't work for you, a second image, which is a dedicated image processing toolbox for Python,
has a much more advanced image array. But it should be able to. And the second image also has good proteins to save. So, basically if you wanted lots of images, if you wanted image manipulation, you, at some point, you'll be using a second image.
Okay? Any questions? So that's all I want to cover on SciPy. So I started with a few very basic step models, and we're going to move into more advanced features, where we need to think a bit more. The other thing that I think is useful to know
is a SciPy special. So basically, SciPy special are what's known as special functions, mathematical functions. So any word mathematical function, like a Bessel function, like a gamma function, a log gamma,
you'll find in there. So basically, if you need any word mathematical functions, you'll find in there. So like the Earth function. So I'm not going to list all of them. Of course, you'll find the list on the documentation of SciPy, if you ever need it.
And usually just, I mean, if you Google SciPy Earth function, you'll find it. Okay? Linear algebra. So, by the way, NumPy provides linear algebra. I don't know if you've used it so far. I would advise you to probably use SciPy linear algebra.
The reason is it's possible to compile NumPy linear algebra without a good linear algebra backing. The reason this is done is that some people don't care. But the problem is this can give you a visible performance, whereas it's not possible to compile SciPy
with a bad linear algebra backing. So you're more likely, when you're using SciPy linear algebra, to get a good linear algebra backing. And the difference in speed can be factors of 70 or more. Yeah. The computational linear algebra is something that people have been working on for a long time.
So I would advise you to use SciPy linear algebra, but overall it's very similar. It has a very similar interface to NumPy linear. So we have things to compute the determinant of a matrix.
So one matrix here, I needed two in the array. I don't know if people have covered this before me, but NumPy has a matrix object that looks like a NumPy array but is not a NumPy array. Don't use it. Just don't use it.
The reason is because it looks like a NumPy array and it's not a NumPy array. It behaves differently than a NumPy array on two small places. And if you start mixing in your code matrices and arrays, at some point you'll get it wrong. And if you don't, a colleague will get it wrong, a library will get it wrong.
So don't use the NumPy matrices. You can transform a matrix into an array? Yeah, two arrays. Well, I mean, matrices, NumPy matrices are really there
There are a few people in the world that would be up to them and think they're really cool. I don't know if they're really cool. So I can do linear algebra and I can find just a 2D array and that will be my matrix and I can compute its determinant. And here, the determinant is minus 3.
This is, I believe, a non-inversal matrix and if I compute the determinant, it's 0.
And by the way, I can invert matrices with scipy.daniad.in and let me try to invert the matrix above.
So it crashed. It says it's a singular matrix but it's non-invertible and this makes sense because the determinant was 0.
What if we really want you guys know what a pseudo-inverse is? A pseudo-inverse is something where you multiply it to a matrix and it gives either 1 or 0. Anyhow, a pseudo-inverse is an inverse that works even when the matrix is not invertible
because it fills in with 1. So I can use pn to do this. And I can multiply the array with its pseudo-inverse giving it a dot and I'm not getting 1.
I see a lot of confused books so if you don't know what this is don't know. You don't need it. In the same merge function does it always do the same operation or does it consider the structure? No, no, it always does the same operation. The structure, the matrix here
does not have a structure. This is not a sparse matrix. If you're using sparse matrices then well, the first thing is you should probably not invert them. Yeah, you probably don't want to invert the sparse matrices because if you invert the sparse matrices in many situations not all
but many situations can become dense not all. Yeah, okay, so if you have a diagonal matrix it doesn't. I do believe they have an invert an inverse. I'm not sure. I'm not sure if they have an inverse method or not. Let's see. A cycline works for us.
And and then we need to create a a diagon with two, three, four.
There's four arguments. So let's have a look at what sparse.spi So data, diagonals, and n. Okay, so it wants
data, I'm only one diagonal and it's a three by three matrix. I think that should work. Okay, yeah. So that's my matrix. And let's see if I can if it has an inverse method.
I don't see anything. I personally never inversed a matrix. I always I never inversed a matrix because I always plug it in a solar.
There are few use cases where it's needed to invert a matrix. Teaching you to invert a matrix is the one you're telling me not to. So what I do instead of inverting a matrix is I most
often plug it into a solar that will because usually you invert a matrix to find the solution of an equation of like a linear equation. So what you do is you use a solar, it's going to be much faster than inverting a matrix. Okay
and the last thing is you can get a singular value decomposition. A singular value decomposition, if you don't know, is Wow, fancy. The
singular value decomposition is dt.
It is an extremely useful school of physiology to write that given the matrix A will compute u as actually the transpose is due to the u where A is an m
by n matrix and then u is u is a matrix that
is a rotation matrix. Okay v is an n by n is an n by n matrix that is also a rotation matrix s is
diagonal n0 Okay Now this is a terribly useful tool but I was actually not taught in PLOS because then you can start
using u and v to simplify that computation. Okay, so then now the SVD will return these things u, v and this guy. Right? And then I can multiply them to retrieve my work. Alright?
So if you look at this formula here, I'm exactly writing the fact that I'm computing u dot s dot v u s v. The transpose I don't know is the question of convention. So we're starting here, I don't need the transpose. Okay? And I'm finding
that it's almost equal to the original way. Does that make sense? Alright. Any? So all of their linear algebra standard operations such as qr and position lu, scholesky
as well as the solver then I know solver that will solve linear equations, matrix vector linear equations. Okay? All available in the sidebar. Any questions? No.
Anybody feeling that this is way too not interesting for them? Go ahead. No? Anybody really hates raising their hand? Nobody? Oh well. Okay. So now let me move on to something a bit
more visual and a bit more easy to understand why being useful interpolation. So we have slide five of interpolate which allows you to interpolate data. And let's
actually let me turn along that button in my new book. Okay? Just to have my new button. I wish I didn't jump this time.
Okay? And then let me just generate a signal and let me plot I don't know why it keeps jumping.
Alright. Anyway. And I need to plot
the measures as a function of the measured time. So we're pretending we have measures at a given time. Okay? That's my signal. So we
have this thing I don't like maybe tide or amount of sunshine at a given time of day. And it's rotating like this and we have only a small number of measurements. And we'd like to interpolate. Actually technically I should
rather plot it like this because I have those measurements. Right now I would like to evaluate the underlying function that I do not know or I don't have data. So I'm intending to do an interpolation and the simplest interpolation is to draw straight lines between the points.
Okay? So this is a 1D problem and I can do an interpolation where the sci-fi.interpolate.interp1D and the way it works is I'm going to so first implant it and then I'm going to give it basically the x and the y and it
returns something. So I'm giving it x and y and it returns something.
Well what's this something? Well this something is something that I can evaluate. I was about to say I can evaluate it but I chose the wrong value. Let me first do it when
it works. This is something I can evaluate. So I'm asking this guy, return the value at point 2. And the value at point 2 is here and it returns just like around 1 isn't it? So what
happened? I asked 1.2 and it complained and it told me that the new value was above the interpolation range. So what does it want to stop at 1? So interp1D does not want to extrapolate. It will not
go outside of its data range. So I can ask it to do linear interpolation for cubic interpolation and I can look at the
docstring, well the docstring of interp1D and we see that it's got a kind argument that by default is linear so it does linear interpolation but I can put to cubic for instance to get cubic interpolation. So here
I've shown you the measures linear interpolation and cubic interpolation. So cubic is basically a third order problem. And if you want to see the code that generated this figure you can just click on the figure
this guy will be great you can click on the figure and then you have the code that generates it. Okay? So you can see that we are interpolating we're building an
interpolator object and then we're evaluating it on data points between 0 and 1 on 50 data points, you can see here and then we're doing the same thing with cubic interpolation and then we're plotting these guys, okay?
Does that make sense? So interp1D is a really easy to use function to do interpolation.
Yeah, it's interp1D. There's something somewhere that's trying to grab my attention but I don't know where.
And it's looking better prone that when a window is trying to get your attention it locks the rest. You guys know how to get rid of it?
Probably you're probably telling me that I'm missing the content. Interpolation
sorry about that.
From the interpolation?
From the interpolation part. And not with this function. So I'm really scaling the surface of a slight body interpolation. Why would you be interested in good efficiency? There are plenty of reasons but I'm asking why. I was just curious. I was
asking the same question and at the moment I can't think of any. So one reason is you want to be interested in the mathematical formulation of the interpolator function, for instance to take a differential of it because you might want to do an optimization on the interpolator function
or not. There are good reasons for that. In this case you want to be interested in using spline interpolation because splines have nice mathematical properties in which case there is a really good spline interpolator in side by interpolator that I'm not covering here, that will
allow you to do things like recover the coefficients. It's slightly technical but people have done things where they get not only the spline interpolator but also its derivative which may be really really nice. You can also store these coefficients to bring them back later. So for instance building the spline interpolator may be
expensive but evaluating it may be cheap. But in this case you probably want to use the spline interpolation and not the QD interpolation which is another version. Any other questions? So we have the same interpolation
same kind of interpolation routine but in 2D, with Interp2D that will basically take this set of measurements in 2D, so x1, x2, and y and that will return a function to which you can get x1, x2 and that will return y. Okay? And there's much more interpolation inside by interpolate
and interpolation is an art of itself and I will not cover it here. Do you guys want to do a full exercise on this or move on to optimization? Optimization. Okay. We'll do exercises, don't worry.
So optimization optimization is basically the problem of finding numerically finding minimums of functions or solutions of integrals. So we have the other function we have and if you want to find its minimum or you want to find its zeros. That's basically
mathematical optimization. But let's start with a very simple example which is curve fitting. Suppose you have this figure and you want to fit and once again it's probably some form of a sine wave it may be, once again, it may be the
time or it may be the amount of sunlight you're getting on a sensor and you want to fit a sine wave to this data. So this is what I'll show you in a new lecture. Let's first generate this data. So let me generate a new data function
because I crashed my previous one. That's it. That's okay. You can go ahead. Okay?
And we'll work with y and b I'll directly import optimize from sine wave. And then I'm going to
create this data and I'm going to plot it.
I'm plotting it. y is the function of x. Again I have its own. Let me plot it without lines so it makes more sense.
Now I want to fit a sine wave to this. So what I will do is I will define, make sure this
graph stays on par. What I will do is I'll define a function that I'll fit to the data. And this function I'll call it test punch.
Okay? So my test punch is going to be a sine wave with an unknown amplitude and a unknown frequency. I haven't added an unknown to the opposite. Okay? So it's a function of x. a and b where x is my
x data. And a and b are my unknowns. And it returns the y value. Okay? So that's the function that I'm hypothesizing will link x to y. So the y is done. And then
I will use scipy.optimize.curve.fit for this. And what scipy.optimize.curve.fit means is the test function, x data and y data and a first guess for parameters. Okay?
So as a first guess I'll just put two and two here because I didn't have a better idea. And what it will return is the values of the parameters that we just did and the covariance of their error. Which I may or may not be interested in.
Okay? So I can print this out. Print this guy. I can print the parameters that I found.
And I found 2.8 and 1.4. If we go back up, does that make sense? What should I have found?
Well 2.9 and 1.5, right? If we look at how I generated the data. But given that there is noise, that's not too bad. Does that make sense? And now what I can do is I can also
plot the function that I found. So how will I do this? I've got this book and I will need to be visual. What I want is literally to plot the function over here. So how can I do this?
Okay, so I can plot the data, this plots the data, but I also want to plot the function. So I'm going to plot it, and I'm going to I need to give it x. What x will I give it? Well one thing I
can do to get a nice a nice plot is I can create a dense x that covers a minus six to six. Then I can evaluate the function of this dense x and plot this.
That would probably be a so let me call this guy dense x. And I'm going to do a dense space that goes from minus six to six with a hundred data points. And then I'll plot dense x dense x and my test
function evaluated on dense x with the first parameter I found and the second parameter okay. And if I manage to match my current pieces
oh no yeah If I manage to plug this right I should get okay and just in case I'm
typing too fast you can click on that current and get the code that generates it. Click on that code and get the code that generates it. Okay and that's it to be sure throughout the tutorial if you want to see the code that generates the figure, you click on it and you get the code and you can download it by
by clicking on it. Alright Any questions on the curve? Questions. What do you choose as in your as one? I didn't choose the P0 in any clever way. I was lazy. I typed in two things and it worked.
But in general you're not guaranteed that so Do you know how curve fitting works? Curve fitting works by minimizing an error between the test function and the observed data. So it's a minimization problem it's an optimization problem and it's not
guaranteed that this optimization is and this is usually a squared error. This is a squared error Minimizing the squared error is not guaranteed that this minimization problem is complex. Hence it's not guaranteed that it will always converge to the right solution. So ideally so it means that the starting point matters not only for convergent speed
the closer you start the faster it will get to the optimum but also to give you the right answer. So ideally you have some understanding of the problem when there is some physical or biological understanding or some knowledge or expertise and use it to give starting points. If you
have learned this well maybe then you need to take a few steps back and write your own optimization problem and solve it with a global optimizer which is going to be expensive. But we're just going to do what we'll see in the next test. Any other questions?
Yes there is. And this is actually a Python question not a sci-fi question so maybe somebody can answer. Exactly. So star in front
of the list of perimeters will expand it. I was purposely avoiding to do this to avoid putting too much sophisticated syntax. Okay? So, as I just discussed
this is just a wrapper over an optimization problem. Curve fitting is just an optimization problem. So we're going to go a step further and look at optimization problems in general. So we're moving to a different problem.
We're moving down. There's an exercise. Do you want to do it or do you want to skip it? Don't do exercise. Do you want to do it? Alright, let's do it. So, we have those temperatures and their temperatures as a total were measured in
LSCA. I just laid around a bit starting with P0 values and I just landed and showed about other algorithms and now it's just completely wrong. So how do I try it? And it will I'm going to check it myself or just
because if I run that result I'm fine. Oh! So we did have an optimization if you had no knowledge of the problem and you ended up in a local solution and you absolutely no knowledge of the problem you're fine.
That's where you know the things like looking at your data should help you. But yes, if you're using things as a complete back box and you don't know well that's a really good introduction to why optimization is important and why we should discuss it. Okay, so just tell me where I've started on the problem.
Yeah, so this is an optimization problem and the way you can think of it is I got those I got those data points and I'm trying to fit a sine wave to them. Let me move this guy here
so I can fit a sine wave like this. But I can also fit a sine wave like this. Both are good fits. Or sort of differential good fits. And that would be a fantastic
introduction to statistical learning why this is probably this might be this but it's off topic. But you know from an optimization problem you come down and you're going into what's the best model that describes data is statistics and statistical learning and it's something I love but it's
it's off topic. Have people thought into this? The picture's in the landscape. The landscape gets really warm in the summer.
You know what, I'll leave you working on this and I'll walk you in there. Don't look at the solution.
Exactly.
Yes, if you thought you want to specify specify specify Yeah. Ok, well first I think it's no you need to give it an x
you're giving it only y you should So again what you plot is good to define also so for this exercise it's good to define an x vector. I haven't given you an x vector. I'm giving you only the y
vector. But you're going to need an x vector if you want to make a link. And then you need to choose what's the unit of the x vector month days seconds you choose
So this problem is very close
to the one we've seen just before fitting a sine wave and you're going to have to fit two different sine waves for the min and the max
This is the
This is the square sine function Ok
Oh yes, of course indeed. But that's for the min So I should call the number for the min and the max
I'll discuss this solution Alright
So let me discuss this solution
The first thing I did was I copy-faced the values in y min and y max because I've got the min and the max values per month and then I defined the vector there of the month that goes from 0 to 11 Ok? And that's the And then I plotted this to check what things look like Ok?
And I just gave blue values for min temperatures and values for max And then I chose the simplest test solution that I could which was unknown average unknown average
tune an unknown offset but known frequency which was a yearly frequency and each time I got my known frequency wrong I would get a student answer. And with this then I just did the same thing before I put in it and in terms of guess
for the different meters well this is this is how I thought about it. Average seems really easy to fit. So I can put whatever I want and zero seems okay because if I split my eyes zero averages are postponed but not grossly wrong.
Amplitude, well I don't want to put amplitude zero because if I put amplitude zero it's gonna make a straight line and that's not going to work for fitting. The reason it's not going to work for fitting is that the algorithm is going to be stuck not knowing how to modify this per meter. So I'm just putting one. Offset, well same guess.
Offset zero, offset seems like an easy thing to fit. So offset zero should work. If I had had the frequency because of the instability that we discussed before I would have needed to put in a good guess for the frequency. That was very
well done. Okay. Very stupid guess here, I'm pretty convinced it will work. So I put the very stupid guess, breadth optimized on perfect, and then to plot the result I created a vector of days expressed as fractions of money, right?
So I knew my vector goes from 1 to 12, explaining 12. So I did a mean space getting from 0 to 12, explaining 12. So I did a mean space getting from 0 to 12 for 365 points.
And then I just evaluated this machine and that's my fit. And it's not perfect, but good enough I would say. Quite clearly for the memory, it's slightly more steep and more salty.
Okay. Any questions on this exercise? So if you look at the solution it's the same idea, just put 4 and same problem. Any questions?
Yeah, so that's the start.
That's the start of the issue. The start of the issue will extend to less than two parameters. Maybe it's not in this solution, or maybe we should change it. One question. If you use these parameters of the test fund many times, you could just fund for it as a result from the fund.
So you just pass the term as once, and then you have to fund for the space over the x.
Are we done with this exercise? Is it clear for everybody? Do you feel we could do this yourself? For many people this is useful. People do fit different things. Okay. If so, let's move on to more general optimization.
And let's start with, so now we're looking at a cost function. It's a different thing. It's not a test function, it's a cost function. And so here, it's just a function of one parameter, and our goal is to find the minimum of this function.
Okay? And I can define it as such. I'm going to define f of x, which is x squared plus ten times sine x.
And I can just plot it, which is what I did before, just about. Let's just do it together. I'm plotting it from minus ten to ten, and this is it. So guess where, approximately where the minimum, somewhere here.
Okay. So the goal of optimization is going to find the minimum here.
And for this, oh and by the way, what's happening here? A local minimum. A local minimum is your evil because you get stuck in there. Okay? So what we're going to do is we're going to use a function that's called optimize.minimize.
And what it takes is it takes the function and its 14 points, and it tries to find the minimum. So I'll make sure I've got optimize and 14.
And so optimize.minimize, and I'm giving it f and a starting point, and I need to start at zero. And I'm just printing the results. Okay?
So what do we see? A lot of information. One of the information is that the algorithm thinks it was successful, so we're happy.
And it tells us x equals minus three, so that's the value of the optimum. It says that the function is minimum for x equals minus three, dot, dot, dot, dot. This also gives, it also gives us the value of the function here. Right?
And extra information, including one of them, which is the number of times it called a function. So if you have a very expensive function, the function is tell your grad student to go out and get more data, then this matters. Okay? And if we want to use the value x, this is, we can just call result.x, and this is going to tell us the value of our algorithm.
Okay? This is a very simple situation, but if you really have a big, expensive function, you might evaluate it often.
And that might be expensive. See? Okay, well let's find this, let's find this together. I was just about to comment on it, but let's find this together. When we get a question about a function, usually the best thing to do about it is to look at its lock string.
So, lock string. Lock string. And, okay, we can see method, and there's a bunch of methods.
And I believe the default, okay, so the default these days is a VMGS, which may or may not be known.
So it has changed, it used to be available to me. Which kind of killed my next example, which was to say, hey, why did we change the method? But still, why did we change the method?
So, if we look at this lock string, we've seen a bunch of different methods. And if you're into optimization, they mean something to you. If you're not into optimization, they don't. But it's fine, you can look them up on Wikipedia. You can look them up on the events chapter, the sci-fi lecture notes that describes them. If they're decision-wise, then basically we can choose between them.
And if our function is smooth, then V of TS or LP of TS is a good choice. I'll tell you this, I'll ask you to take it for granted. If you click, it gets better.
Excuse me? Yes? Could you please change the X0 to 6? Can I do this one a little bit after? I'm covering this in a few minutes. But yeah, I'll do this. I say, I think we're in a hurry.
Okay, let's first let me change the method to an LP of TS, V. So it runs, and what's interesting here? So we're finding pretty much the same value of X.
We're finding pretty much the same value of X as before. What's the difference?
The number of function evaluations went from 24 to 12. So it called a function less, a smaller number of times. So if your function is expensive to compute, the latter is twice as fast.
Only if your function is expensive to compute, which is not the case here. Okay? So, if you end up with expensive optimizations, then worrying about which method is used is important. And you can all use them through the optimized algorithm.
So, we had a question. What if we change your starting point? If we change the starting point, which one do you want?
Did you want? 6. So now we get a different value. What has happened? That's the local minute, right? So basically, our function looks like this.
Let's scroll up back to our function. Our function looks like this, right? So if we start around here, we're going to pull in the local minute and get stuck there. All right? So that's a bit of a problem. And that goes back to curve fixing. What if I get bad starting points?
I get stuck. So, if we fear that we're in such a situation, we can use optimizer basin copy, which is a global optimizer. Okay?
And so I can run it, and I can give it, and I will run it giving it a stupid, a non-optimal starting value like 6. Okay, what did we see? It found the right, let me write, it found x equals minus 1.3.
Could you please try the x zero equal to one? You got it lucky? Why didn't it go from there? That's it for me. So let's first, how does basin-hopping work?
The way basin-hopping works is that it takes, it randomly hops, it uses a smooth optimizer, sees what part of the function it explores, and randomly hops to other places. Okay? So the reason why it didn't work for you is probably you got really unlucky when you're writing hops.
And it goes back to global optimization. Global optimization in general is an unsolved problem. So if you have a function that has bad properties, you cannot guarantee that you will find a good solution.
And anybody who tells you different, these are trouble. So you just got to run it. But, I guess you just keep going, and if you keep doing it, someone will get in the way.
I'm a very lucky person. So, optimizing functions with local minima is something you'd rather want. And if you, and you always end up being an institution, because it's right.
And in which case you'd rather have good starting positions. Okay? Or, the other thing I wanted to point out. May I ask another question on this? Yes. So, I iterated, do you always get into the local minimum as long as they don't turn up the iterations?
So, how is the random generator initialized? Is it initialized each and every time, or is it the same with the number? So, I don't know, but let's try to figure this out together.
Does it say this? One of the reasons I don't know is I really avoid optimization problems that have local minimums. Because I know how to devise my optimization problems.
So I never use this problem. So, the doc string didn't tell me, so I can go one step further and look at the source code. That's genuinely what I do, and I hope no. So, two question marks gets me the source code.
So now I'm making the source code a different sheet. It starts with the doc string, and then I've got the source code. And I'll see, oh, there's a metropolis here.
I will need to dig deep. I will need to open that source file and dig deeper to tell you. So, I don't know. I'm sorry. Yeah, that is directly after the doc string, that's the minimum that the machine operator set up, I think. There's some seats in here.
I did not see where the seat comes from. Then you were better at looking at the source code. Where is it? It seems we have different versions of that already. That's why. So, does that seat, is that seat an argument of your function?
Yeah. Yeah. Okay. So, the gentleman here, which side by version did he have? Probably more recently. So, how do you find this way to find out?
So, in general, to find out the version of the Python library, you import it. So, import side by, and then you print the library side by dot, and then underscore, underscore version, underscore, underscore. So, I have 0.71. You must have a more recent one.
So, the gentleman over there has a seat argument that is set to his base and help encryption. Or 0.90. Or 0.90. So, you have a more recent one. So, in the more recent one, they have chosen to seat the random number generator.
So, the function is reproducible. And the random reproducible means it's also reproducibly bad sometimes. Okay. Yeah. So, the other thing that's interesting to point out is the number of function evaluations.
It's huge. So, if you're optimizing costly functions, they better be convex. Which means, which implies that they only have a good one. Alright. So, we only have ten minutes left.
And we've covered, I don't know what fraction of a minute. I seem to remember I used to be able to cover this in an hour. That's the whole thing. So, we're just going to have to make choices. And let me go back to the list of things we could cover.
And I'll comment on this. So, optimize, there's one thing that I haven't covered. And it's root winding. So, if you scroll down a bit, you will find root winding.
Oh, one thing I have covered with optimization is we can add new strings. You can easily add bound constraints by adding the keyword bounds. So, basically, if I want to lock my optimization between zero and ten,
X between zero and ten, then the solver will work only between zero and ten. And then there's root winding, which is the idea that, I'm trying to find the values where F of X is equal to zero. So, it's a similar idea than minimization.
And you have optimize dot root, which does the same thing. Okay? And in general, it's solved by a special minimization point. Okay? Then we have statistics. So, then, I'll consider that we're done with optimize.
We can talk about optimization for hours or days, I love it. But in the interest of time, we'll move up. There's statistics. So, SciPy has very basic statistics support. But basically, a bunch of interesting thing it has is that it has distribution objects.
So, SciPy dot stats has, for instance, the normal distribution. Exploited SciPy dot stats dot norm for normal. And that distribution, overall, has a PDF, permanent density function.
A CDF, a cumulative density function. A nice set and only a zoo of different statistical methods. So, you can compute all these.
So, you have this for the normal distribution, for the gamma distribution, for, I guess, the Poisson of beta, or this zoo of distributions, the econometric distributions, you notice in the right place. Another interesting thing of these distributions is that if you give them data,
and you call fit, so the stats dot norm dot fit, the distribution will estimate its internal parameters. And for the normal distributions, we have two internal parameters, which is the location of the center and the standard deviation.
So, it will do this, and it will do this by a maximum likelihood estimate. So, a good estimate. And this will work for all the distributions. So, you can work with distribution. And we'll skip the exercise in the interest of time. And you can compute mean and meanings, which we will also skip in the interest of time.
And you can compute a bunch of statistical tests. So, what are statistical tests? So, suppose you're observing data from two different populations,
like the Germans and the French. And you're trying to see if the Germans speak better English than the French. So, we give an English proficiency test to the Germans and the French, and we get only a dozen results because testing people is expensive, and that's when we compare the population. So, then what we're going to do, so we're going to find the difference, right?
Unless we're extremely lucky or unlucky, we are going to find the difference, because we're going to test a dozen people here, and the people there are going to get numbers, and because there is noise running the same thing, we're going to find the difference. Is this difference significant or not? Are we going to write a paper that reports the Germans speak better English
than the French, which I believe is true, by the way, being French. But if you write this, you need to know whether the difference that we found is significant or whether it could be just chance. And this is known as the statistical test.
So, the statistical testing is a science, not an art. It's a difficult one, but at least sci-fi gives you the major statistical tests. So, if you know that you want to be using a t-test from two independent samples to compare the Germans from the French,
then you can use sci-fi.stats, the t-test in or t-test in a minute, and it will return the p-value, well, it will return the t-statistic and the p-value, the p-value being the probability that the two set of numbers are the same under the chance.
So, if you followed, I have a very small p-value, does that mean that the Germans and the French speak English differently? So, what's the definition of the p-value? It's the probability of observing what you observe under chance. If it's small, it means that the reason is probably significant.
Okay? If you're interested in this, there's a chapter in Sci-fi literature that goes way more into detail. I need to skip integration. I'm just going to mention that we can compute numerically integrals of functions,
or we can integrate a differential equation. So, here is just a damping equation where I'm saying that I have a damping force that's proportional to how far I am. Well, I've got a, not a damping force, a regal force that's proportional to how far I am from zero.
I let my system go, and it will progressively go to zero. That's known as a differential equation, and you can integrate that numerically here. So, if you add a damping, then you can get an oscillator medium.
We have FFTs, Fourier transforms, and, preparing this tutorial, my conclusions about FFTs are the following. If you know what you're doing in signal processing at a blind mat, you want to use FFTs. If you don't know what you're doing, you don't want to use them, even if you think you do.
That is seriously my conclusion. If you want to compute the power spectral density of a signal, you can try to compute it with an FFT, and if you know what you're doing, you're going to do it right, and if you don't, you're going to get it wrong.
So, what you want to do, you want to move on to signal processing. Oh, and if you try to implement a concern with FFTs, you can. It's very easy, and you don't get it wrong. So, don't do it. And so, you can move on to signal processing. And so, signal processing is typically, well, that really was my conclusion.
I'm trying to find good examples of using FFTs, and they were all very complex. I can only find simple but bad examples of using FFTs. Signal processing, 5.0 signal, is basically to deal with 1D regularly sampled signals. So, it will allow you to do things like resampling, so typically interpolation,
look for 1D regularly sampled signal. It will allow you to do things like detrending, or median filtering, or venial filtering. Venial filtering is a good guess if you don't know what you're doing about filtering. You want to remove a high-frequency signal.
And you can compute a power spectrum in CT using a proper method to do it. So, once again, don't implement it yourself. Okay. Moving on. There's a bit of image manipulation, as I mentioned in sci-fi,
in the image, and we have things like, you know, geometrical transform, so like shearing, rotating, shifting. We have things like filtering, Gaussian filtering, median filtering. I'm using the venial filter from similar here.
And we have things like mathematical morphologies. Mathematical morphology, let me skip to this example, is applying a set of extremely simple operations to boundaries.
That's not a mathematical definition, but it's okay. And you can use it typically to remove patches that are smaller than one pixel if you're blending it once, or two pixels if you're blending it twice.
So this is typically useful for cleaning binary images. One important comment on this is that these operations may be useful even if you're not doing image processing. If you're trying to, if you're doing, you're burning your search,
and you're thresholding your burning your search, and then you're trying to paint it in some way. This is not an image operation in the sense of not taking pictures and processing pictures. But it may be useful, and often people forget that they have a 2D or 3D array that doesn't come from an image. It may be useful to apply an image on it.
And the last very useful thing in an empty image is labeling the net components. So if here I ask you to color every object in a different color, you'll do it.
You won't have any problems. Now labeling the component is doing the exact same thing. It's assigning a different number to every net component. And once again, this may be extremely useful outside of image processing. It may work on a 1D signal. You have a 1D signal, you threshold it, and then you want to find the largest interval.
You may then, or you may easily use ndimage.label to label the net components here. And then ndimage.sub. ndimage.sub will sum the value of the data on each connect component, on each label.
So if I give it as a label the connect component, then I'm finding the sum of the data on each connect component. So I can use this to do things like finding the largest connect component. Just keep in mind that if you want to operate on connect components, ndimage is there for you.
And this is the end. We have plenty of exercises that we won't have time to cover. I think, to respect copyright, I should stop here. You can always come back to this material or to the Sci-Fi documentation, and if you have any questions, I'm unable.
Thank you.